]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
CHIPS: Fix potential starvation in cfi_cmdset_0001
authorJosh Boyer <jdub@us.ibm.com>
Tue, 6 Dec 2005 17:28:19 +0000 (17:28 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Wed, 17 May 2006 00:11:17 +0000 (01:11 +0100)
The patch below fixes a potential starvation issue that can arise when
there is contention on a chip during a period when a process is
currently writing to it.  The starvation is avoided by conditionally
rescheduling when the chip is left in a state usable by other processes.

Signed-off-by: Josh Boyer <jdub@us.ibm.com>
Signed-off-by: Tom Gall <tom_gall@vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/chips/cfi_cmdset_0001.c

index 898c321ab86de2d6a3044c4af105b40d2aebb878..e797752f7c0b7640852c0799aa8ac5824f1fed4d 100644 (file)
@@ -1691,6 +1691,11 @@ static int cfi_intelext_writev (struct mtd_info *mtd, const struct kvec *vecs,
                        if (chipnum == cfi->numchips)
                                return 0;
                }
+
+               /* Be nice and reschedule with the chip in a usable state for other
+                  processes. */
+               cond_resched();
+
        } while (len);
 
        return 0;