From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Chuck Ebbert <cebbert@redhat.com>,
Antoine Martin <antoine@nagafix.co.uk>,
Satyam Sharma <satyam.sharma@gmail.com>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: CFS: some bad numbers with Java/database threading [FIXED]
Date: Wed, 19 Sep 2007 13:28:47 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.999.0709191306530.16478@woody.linux-foundation.org> (raw)
In-Reply-To: <20070919195633.GA23595@elte.hu>
On Wed, 19 Sep 2007, Ingo Molnar wrote:
>
> in CFS we dont have a per-nice-level rbtree, so we cannot move it dead
> last within the same priority group - but we can move it dead last in
> the whole tree. (then they'd be put even after nice +19 tasks.) People
> might complain about _that_.
Yeah, with reasonably good reason.
The sched_yield() behaviour is actually very well-defined for RT tasks
(now, whether it's a good interface to use or not is still open to debate,
but at least it's a _defined_ interface ;), and I think we should at least
try to approximate that behaviour for normal tasks, even if they aren't
RT.
And the closest you can get is basically to say something that is close to
"sched_yield()" on a non-RT process still means that all
other runnable tasks in that same nice-level will be scheduled
before the task is scheduled again.
and I think that would be the optimal approximation of the RT behaviour.
Now, quite understandably we might not be able to actually get that
*exact* behaviour (since we mix up different nice levels), but I think
from a QoI standpoint we should really have that as a "target" behaviour.
So I think it should be moved back in the RB-tree, but really preferably
only back to behind all other processes at the same nice-level.
So I think we have two problems with yield():
- it really doesn't have very nice/good semantics in the first place for
anything but strict round-robin RT tasks.
We can't do much about this problem, apart from trying to make people
use proper locking and other models that do *not* depend on yield().
- Linux has made the problem a bit worse by then having fairly arbitrary
and different semantics over time.
This is where I think it would be a good idea to try to have the above
kind of "this is the ideal behaviour - we don't guarantee it being
precise, but at least we'd have some definition of what people should
be able to expect is the "best" behaviour.
So I don't think a "globally last" option is at all the best thing, but I
think it's likely better than what CFS does now. And if we then have some
agreement on what would be considered a further _improvement_, then that
would be a good thing - maybe we're not perfect, but at least having a
view of what we want to do is a good idea.
Btw, the "enqueue at the end" could easily be a statistical thing, not an
absolute thing. So it's possible that we could perhaps implement the CFS
"yield()" using the same logic as we have now, except *not* calling the
"update_stats()" stuff:
__dequeue_entity(..);
__enqueue_entity(..);
and then just force the "fair_key" of the to something that
*statistically* means that it should be at the end of its nice queue.
I dunno.
Linus
next prev parent reply other threads:[~2007-09-19 20:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-12 23:10 CFS: some bad numbers with Java/database threading Antoine Martin
2007-09-13 7:18 ` David Schwartz
2007-09-12 23:33 ` Nick Piggin
2007-09-13 19:02 ` Antoine Martin
2007-09-13 21:47 ` David Schwartz
2007-09-13 11:24 ` CFS: " Ingo Molnar
2007-09-14 8:32 ` Ingo Molnar
2007-09-14 10:06 ` Satyam Sharma
2007-09-14 15:25 ` CFS: some bad numbers with Java/database threading [FIXED] Antoine Martin
2007-09-14 15:32 ` Ingo Molnar
2007-09-18 17:00 ` Chuck Ebbert
2007-09-18 22:46 ` Ingo Molnar
2007-09-18 23:02 ` Chuck Ebbert
2007-09-19 18:45 ` David Schwartz
2007-09-19 19:48 ` Chris Friesen
2007-09-19 22:56 ` David Schwartz
2007-09-19 23:05 ` David Schwartz
2007-09-19 23:52 ` David Schwartz
2007-09-19 19:18 ` Ingo Molnar
2007-09-19 19:39 ` Linus Torvalds
2007-09-19 19:56 ` Ingo Molnar
2007-09-19 20:26 ` Ingo Molnar
2007-09-19 20:28 ` Linus Torvalds [this message]
2007-09-19 21:41 ` Ingo Molnar
2007-09-19 21:49 ` Ingo Molnar
2007-09-19 21:58 ` Peter Zijlstra
2007-09-26 1:46 ` CFS: new java yield graphs Antoine Martin
2007-09-27 8:35 ` Ingo Molnar
2007-09-19 20:00 ` CFS: some bad numbers with Java/database threading [FIXED] Chris Friesen
2007-09-14 16:01 ` CFS: some bad numbers with Java/database threading Satyam Sharma
2007-09-14 16:08 ` Satyam Sharma
2007-09-17 12:17 ` Antoine Martin
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=alpine.LFD.0.999.0709191306530.16478@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=antoine@nagafix.co.uk \
--cc=cebbert@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=satyam.sharma@gmail.com \
/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
all inboxes | Powered by JetHome®