I disagree. I think CFS made "sched_yield()" worse, and what you call "bug
workaround" is likely the *better* behaviour.
The fact is, sched_yield() is not - and should not be - about
"recalculating the position in the scheduler queue" like you do now in
CFS.
It very much is about moving the thread *dead last* within its priority
group.
That's what it does for round-robin, and it's not about fairness, it's
about
- Opengroup:
DESCRIPTION
The sched_yield() function forces the running thread to
relinquish the processor until it again becomes the head of its
thread list. It takes no arguments.
- Linux man-page:
DESCRIPTION
A process can relinquish the processor voluntarily without
blocking by calling sched_yield. The process will then be moved
to the end of the queue for its static priority and a new process
gets to run.
and quite frankly, the current CFS behaviour simply looks buggy. It should
simply not move it to the "right place" in the rbtree. It should move it
*last*.
Linus
-