Messages in this thread | | | From | Anton Blanchard <> | Date | Mon, 12 Mar 2001 12:24:47 +1100 | Subject | Re: sys_sched_yield fast path |
| |
Hi,
> 2.4.x has changed the scheduler behaviour so that the task that call > sched_yield() is not rescheduled by the incoming schedule(). A flag is > set ( under certain conditions in SMP ) and the goodness() calculation > assign the lower value to the exiting task ( this flag is cleared in > schedule_tail() ).
The behaviour I am talking about is when there is a heavily contended spinlock, and more than one task is trying to obtain it. Since SCHED_YIELD only changes the goodness when we are trying to reschedule the task we can bounce between two or more tasks doing sched_yield() for a while before finally running the task that has the spinlock.
Of course with short lived spinlocks you should rarely get the case where a task grabs a spinlock just before its timeslice is up, so maybe the answer is just to spin a few times on sched_yield() then back off to nanosleep() like pthreads does.
Anton - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |