public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
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>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: CFS: some bad numbers with Java/database threading [FIXED]
Date: Wed, 19 Sep 2007 14:00:28 -0600	[thread overview]
Message-ID: <46F17FDC.6030903@nortel.com> (raw)
In-Reply-To: <20070919191837.GA19500@elte.hu>

Ingo Molnar wrote:
> > The correct way to tell the kernel that the task is blocked is to use 
> futexes for example, or any kernel-based locking or wait object - there 
> are myriads of APIs for these. (The only well-defined behavior of yield 
> is for SCHED_FIFO/RR tasks - and that is fully preserved in CFS.)

Certainly this is reasonable for applications for which the source is 
available and readily recompilable.  However, there are legacy 
closed-source apps out there expecting sched_yield() to result in a 
reasonable amount of time passing before the task is scheduled again.

Also, there are installed bases of people that may have older versions 
of code that may wish to upgrade to newer kernels without upgrading the 
rest of the system.  It seems odd to force them to update userspace apps 
just because we don't like the undefined semantics.

> To avoid the reoccuring problems of applications mistakenly relying on 
> sched_yield(), we now context-switch on yield very weakly for 
> SCHED_OTHER tasks...

<snip>

> My patch below adds a sysctl flag that triggers a context-switch when 
> yield is called... <snip>    I think the patch 
> cannot hurt (it does not change anything by default) - but we should not 
> turn the workaround flag on by default. If you agree that we should do 
> this, then please pull this single patch from the sched.git tree:

I've always understood one of the kernel's basic tenets to be that we 
don't break userspace without a good reason.  If there are apps out 
there that expect sched_yield() to give up the cpu, it seems 
counter-intuitive to ignore that expectation.

Personally, I'd be in favour of making the context-switch be the default 
behaviour, but at the very least it should be possible to enable a 
"backwards-compatibility mode" for sched_yield().

Chris

  parent reply	other threads:[~2007-09-19 20:00 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
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                   ` Chris Friesen [this message]
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=46F17FDC.6030903@nortel.com \
    --to=cfriesen@nortel.com \
    --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 \
    --cc=torvalds@linux-foundation.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