public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Amol Lad <amol@verismonetworks.com>,
	linux kernel <linux-kernel@vger.kernel.org>,
	kernel Janitors <kernel-janitors@lists.osdl.org>
Subject: Re: [PATCH] drivers/mmc/mmc.c: Replacing yield() with a better	alternative
Date: Thu, 12 Oct 2006 15:54:22 +1000	[thread overview]
Message-ID: <452DD88E.4030707@yahoo.com.au> (raw)
In-Reply-To: <1160571491.3000.372.camel@laptopd505.fenrus.org>

Arjan van de Ven wrote:
> On Wed, 2006-10-11 at 18:15 +0530, Amol Lad wrote:
> 
>>In 2.6, the semantics of calling yield() changed from "sleep for a
>>bit" to "I really don't want to run for a while".  This matches POSIX
>>better, but there's a lot of drivers still using yield() when they mean
>>cond_resched(), schedule() or even schedule_timeout().
>>
>>For this driver cond_resched() seems to be a better
>>alternative
>>
> 
> 
> are you sure?
> 
> 
>>Tested compile only
>>
>>Signed-off-by: Amol Lad <amol@verismonetworks.com>
>>---
>>diff -uprN -X linux-2.6.19-rc1-orig/Documentation/dontdiff linux-2.6.19-rc1-orig/drivers/mmc/mmc.c linux-2.6.19-rc1/drivers/mmc/mmc.c
>>--- linux-2.6.19-rc1-orig/drivers/mmc/mmc.c	2006-10-05 14:00:46.000000000 +0530
>>+++ linux-2.6.19-rc1/drivers/mmc/mmc.c	2006-10-11 17:57:02.000000000 +0530
>>@@ -454,7 +454,7 @@ static void mmc_deselect_cards(struct mm
>> static inline void mmc_delay(unsigned int ms)
>> {
>> 	if (ms < HZ / 1000) {
>>-		yield();
>>+		cond_resched();
>> 		mdelay(ms);
> 
> 
> 
> this probably wants msleep(), especially with hrtimers comming up; there
> the sleeps are always exact...

The condition looks broken too. It should be
if (ms < 1000 / HZ) {...}

Shouldn't it?
-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  parent reply	other threads:[~2006-10-12  5:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 12:45 [PATCH] drivers/mmc/mmc.c: Replacing yield() with a better alternative Amol Lad
2006-10-11 12:58 ` Arjan van de Ven
2006-10-11 14:16   ` most users of msleep_interruptible are broken Matthew Wilcox
2006-10-11 14:20     ` Pierre Ossman
2006-10-11 14:53       ` Arjan van de Ven
2006-10-11 15:07         ` Pierre Ossman
2006-10-11 20:30     ` Pavel Machek
2006-10-12  5:54   ` Nick Piggin [this message]
2006-10-16  6:49     ` [PATCH] drivers/mmc/mmc.c: Replacing yield() with a better alternative Pierre Ossman
2006-10-22 20:23 ` Pierre Ossman

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=452DD88E.4030707@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=amol@verismonetworks.com \
    --cc=arjan@infradead.org \
    --cc=kernel-janitors@lists.osdl.org \
    --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