From: Robert Love <rml@tech9.net>
To: Rick Lindsley <ricklind@us.ibm.com>
Cc: Andrew Morton <akpm@digeo.com>,
Maciej Soltysiak <solt@dns.toxicfilms.tv>,
linux-kernel@vger.kernel.org, frankeh@us.ibm.com
Subject: Re: must-fix list for 2.6.0
Date: 30 Apr 2003 19:41:32 -0400 [thread overview]
Message-ID: <1051746092.17629.25.camel@localhost> (raw)
In-Reply-To: <200304302311.h3UNB2H27134@owlet.beaverton.ibm.com>
On Wed, 2003-04-30 at 19:11, Rick Lindsley wrote:
> OLD: when sched_yield() is called the task moves to expired,
> every other task in the active queue will run first before the
> yielding task will run again.
I really think this is the right way.
> NEW: move the yielding task to the end of its current priority level,
> but keeps it active not expired.
This takes us back to the problem we saw in earlier sched_yield()
implementations. A group of yielding threads just round-robin between
themselves, yielding over and over. Worse, even a single task alone in
a priorty level will show up as a CPU hog if it keeps calling
sched_yield() in a loop.
It goes on. Assume we have two runnable tasks, one that does whatever
it wants (hopefully something useful), and the other which does:
while(1)
sched_yield();
With the current sched_yield(), the second will receive much less
processor time than the first (nearly none vs. most of the processor).
With the sched_yield() mentioned above, they will receive identical
amounts of processor time. That does not seem sane to me.
I think it is important that sched_yield() give processor time to all
tasks, and not just between multiple yielding tasks.
The current implementation does this. If an application (*cough* Open
Office *cough*) calls sched_yield() over and over, what does it expect?
Now that we have futexes, sched_yield() no longer needs to be used as a
poor replacement for blocking, and it can have sane semantics, such as
_really_ yielding the processor.
> What else could be done?
> (a) drop the effective priority of the yielding task by a percentile,
> but don't reduce the time slice!
This works, too. We used to do this..
There are a couple bits that need to be added, though, to deal with
threads that call sched_yield() over and over (which are the ones where
we have problems). We need to drop the task a priority level every time
it calls sched_yield(). Eventually it will reach the lowest priority
(or some earlier threshold we want to check for) and then we need to put
it on the expired list, like the current behavior.
So for the big offenders, I think this ends up being the same, no?
Also, this approach does not work for real-time tasks, for whom we must
not change their priority... so we end up just requeing them, too.
Just my thoughts...
Robert Love
next prev parent reply other threads:[~2003-04-30 23:29 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-29 22:57 must-fix list for 2.6.0 Andrew Morton
2003-04-29 23:22 ` John Bradford
2003-04-29 23:37 ` Andrew Morton
2003-04-30 3:19 ` William Lee Irwin III
2003-04-30 4:45 ` Andrew Morton
2003-04-30 4:52 ` William Lee Irwin III
2003-05-01 4:32 ` William Lee Irwin III
2003-04-30 8:30 ` Benjamin Herrenschmidt
2003-04-30 10:16 ` Maciej Soltysiak
2003-04-30 19:11 ` Andrew Morton
2003-04-30 23:11 ` Rick Lindsley
2003-04-30 23:21 ` Andrew Morton
2003-04-30 23:47 ` viro
2003-04-30 23:59 ` Andrew Morton
2003-05-01 6:27 ` Christoph Hellwig
2003-05-01 5:49 ` Shawn
2003-05-01 10:14 ` Christoph Hellwig
2003-05-01 9:47 ` Alan Cox
2003-05-01 15:44 ` Robert Love
2003-05-01 0:09 ` Robert Love
2003-05-01 0:51 ` Gerrit Huizenga
2003-05-01 5:40 ` Dave Hansen
2003-05-01 11:57 ` Bill Huey
2003-04-30 23:53 ` Robert Love
2003-05-01 8:36 ` Arjan van de Ven
2003-05-01 8:42 ` Andrew Morton
2003-05-01 8:47 ` Arjan van de Ven
2003-04-30 23:41 ` Robert Love [this message]
2003-05-01 16:50 ` Hubertus Franke
2003-05-01 3:21 ` Mike Galbraith
2003-05-01 6:26 ` Mike Galbraith
2003-05-01 14:33 ` Christoph Hellwig
2003-05-01 18:42 ` Andrew Morton
2003-05-01 18:47 ` Christoph Hellwig
2003-05-02 1:57 ` Andreas Boman
[not found] <20030429155731.07811707.akpm@digeo.com.suse.lists.linux.kernel>
2003-04-30 1:36 ` Andi Kleen
2003-04-30 18:09 ` Pavel Machek
2003-04-30 18:15 ` Andi Kleen
2003-04-30 19:11 ` Pavel Machek
[not found] <20030429231009$1e6b@gated-at.bofh.it>
2003-04-30 4:55 ` Florian Weimer
2003-04-30 10:18 ` Maciej Soltysiak
2003-05-01 11:24 ` David S. Miller
2003-05-01 11:27 ` Florian Weimer
2003-05-01 12:03 ` David S. Miller
2003-05-01 12:05 ` David S. Miller
2003-05-02 16:28 ` Carl-Daniel Hailfinger
2003-05-02 21:14 ` David S. Miller
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=1051746092.17629.25.camel@localhost \
--to=rml@tech9.net \
--cc=akpm@digeo.com \
--cc=frankeh@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ricklind@us.ibm.com \
--cc=solt@dns.toxicfilms.tv \
/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