Skip to content

Commit

Permalink
CHIPS: Fix potential starvation in cfi_cmdset_0001
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Josh Boyer authored and David Woodhouse committed May 17, 2006
1 parent ba9627b commit df54b52
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/mtd/chips/cfi_cmdset_0001.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit df54b52

Please sign in to comment.