CHIPS: Fix potential starvation in cfi_cmdset_0001

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue May 16 20:59:01 EDT 2006


Commit:     df54b52c411befdcf1d0989f939a49163570ad29
Parent:     ba9627b85fcb5ed67285ca0711f0f4d1e965746e
Author:     Josh Boyer <jdub at us.ibm.com>
AuthorDate: Tue Dec 6 17:28:19 2005 +0000
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Wed May 17 01:11:17 2006 +0100

    CHIPS: Fix potential starvation in cfi_cmdset_0001
    
    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 at us.ibm.com>
    Signed-off-by: Tom Gall <tom_gall at vnet.ibm.com>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>

 drivers/mtd/chips/cfi_cmdset_0001.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 898c321..e797752 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1691,6 +1691,11 @@ static int cfi_intelext_writev (struct m
 			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;



More information about the linux-mtd-cvs mailing list