public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gall <tom_gall@vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: MTD: fix possible starvation in cfi_cmdset_0001.c
Date: Fri, 02 Dec 2005 15:04:10 -0600	[thread overview]
Message-ID: <4390B6CA.2090006@vnet.ibm.com> (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!

Signed-off-by: Josh Boyer <jdub@us.ibm.com>
Signed-off-by: Tom Gall <tom_gall@vnet.ibm.com>

 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) tom_gall@vnet.ibm.com    553-4558
h) tgall@uberh4x0r.org
"We want great men who, when fortune frowns, will not be discouraged." 
-- Colonel Henry Knox


                 reply	other threads:[~2005-12-02 21:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4390B6CA.2090006@vnet.ibm.com \
    --to=tom_gall@vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox