--- kernel/sched.c.orig Wed May 30 01:17:24 2001 +++ kernel/sched.c Wed May 30 12:30:03 2001 @@ -145,6 +145,11 @@ { int weight; + if (p->policy & SCHED_YIELD) { + /* do not schedule yielded process now */ + return -1; + } + /* * Realtime process, select the first one on the * runqueue (taking priorities within processes @@ -183,25 +188,6 @@ } /* - * subtle. We want to discard a yielded process only if it's being - * considered for a reschedule. Wakeup-time 'queries' of the scheduling - * state do not count. Another optimization we do: sched_yield()-ed - * processes are runnable (and thus will be considered for scheduling) - * right when they are calling schedule(). So the only place we need - * to care about SCHED_YIELD is when we calculate the previous process' - * goodness ... - */ -static inline int prev_goodness (struct task_struct * prev, - struct task_struct * p, int this_cpu) -{ - if (p->policy & SCHED_YIELD) { - p->policy &= ~SCHED_YIELD; - return 0; - } - return goodness(prev, p, this_cpu); -} - -/* * the 'goodness value' of replacing a process on a given CPU. * positive value means 'replace', zero or negative means 'dont'. */ @@ -740,6 +726,10 @@ /* Do we need to re-calculate counters? */ if (!c) goto recalculate; + + /* clean up potential SCHED_YIELD bit */ + prev->policy &= ~SCHED_YIELD; + /* * from this point on nothing can prevent us from * switching to the next task, save this fact in @@ -809,7 +799,7 @@ } still_running: - c = prev_goodness(prev, prev, this_cpu); + c = goodness(prev, prev, this_cpu); next = prev; goto still_running_back;