Skip to contentSkip to conversation

MTD: fix possible starvation in cfi_cmdset_0001.c

PATCH Thomas Gall 1 participant 1 message Dec 2, 2005 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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!

drivers/mtd/chips/cfi_cmdset_0001.c | 5 +++++

1 files changed, 5 insertions(+)
drivers/mtd/chips/cfi_cmdset_0001.c +0 -0
Index: mtd/drivers/mtd/chips/cfi_cmdset_0001.c
===================================================================
@@ -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;
Signature · 4 lines
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