[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <45F6512E.8000802@yahoo.com.au>
Date: Tue, 13 Mar 2007 18:22:22 +1100
From: Nick Piggin <nickpiggin@...oo.com.au>
To: davids@...master.com
CC: Matt Mackall <mpm@...enic.com>,
linux-kernel <linux-kernel@...r.kernel.org>, ck@....kolivas.org
Subject: Re: RSDL-mm 0.28
David Schwartz wrote:
>>>There's a substantial performance hit for not yield, so we probably
>>>want to investigate alternate semantics for it. It seems reasonable
>>>for apps to say "let me not hog the CPU" without completely expiring
>>>them. Imagine you're in the front of the line (aka queue) and you
>>>spend a moment fumbling for your wallet. The polite thing to do is to
>>>let the next guy in front. But with the current sched_yield, you go
>>>all the way to the back of the line.
>
>
>>Well... are you advocating we change sched_yield semantics to a
>>gentler form? This is a cinch to implement but I know how Ingo feels
>>about this. It will only encourage more lax coding using sched_yield
>>instead of proper blocking (see huge arguments with the ldap people on
>>this one who insist it's impossible not to use yield).
>
>
> The basic point of sched_yield is to allow every other process at the same
> static priority level a chance to use the CPU before you get it back. It is
> generally an error to use sched_yield to be nice. It's nice to get your work
> done when the scheduler gives you the CPU, that's why it gave it to you.
>
> It is proper to use sched_yield as an optimization when it more efficient to
> allow another process/thread to run than you, for example, when you
> encounter a task you cannot do efficiently at that time because another
> thread holds a lock.
>
> It's also useful prior to doing something that can most efficiently be done
> without interruption. So a thread that returns from 'sched_yield' should
> ideally be given a full timeslice if possible. This may not be sensible if
> the 'sched_yield' didn't actuall yield, but then again, if nothing else
> wants to run, why not give the only task that does a full slice?
>
> In no case is much of anything guaranteed, of course. (What can you do if
> there's no other process to yield to?)
>
> Note that processes that call sched_yield should be rewarded for doing so
> just as process that block on I/O are, assuming they do in fact wind up
> giving up the CPU when they would otherwise have had it.
>
> DS
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists