Re: CFS: some bad numbers with Java/database threading [FIXED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux