[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46F17FDC.6030903@nortel.com>
Date: Wed, 19 Sep 2007 14:00:28 -0600
From: "Chris Friesen" <cfriesen@...tel.com>
To: Ingo Molnar <mingo@...e.hu>
CC: Chuck Ebbert <cebbert@...hat.com>,
Antoine Martin <antoine@...afix.co.uk>,
Satyam Sharma <satyam.sharma@...il.com>,
Linux Kernel Development <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: CFS: some bad numbers with Java/database threading [FIXED]
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
-
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