MTD: fix possible starvation in cfi_cmdset_0001.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Please CC Josh and myself and replies.  Thanks!

Signed-off-by: Josh Boyer <[email protected]>
Signed-off-by: Tom Gall <[email protected]>

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

Index: mtd/drivers/mtd/chips/cfi_cmdset_0001.c
===================================================================
--- mtd.orig/drivers/mtd/chips/cfi_cmdset_0001.c	2005-11-07 15:04:33.000000000 -0600
+++ mtd/drivers/mtd/chips/cfi_cmdset_0001.c	2005-11-08 08:54:54.000000000 -0600
@@ -1695,6 +1695,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;

--
Linux Technology Center
Senior Software Engineer, - Embedded Linux w) [email protected] 553-4558
h) [email protected]
"We want great men who, when fortune frowns, will not be discouraged." -- Colonel Henry Knox

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux