Messages in this thread | | | Date | Fri, 17 Jan 2014 14:33:11 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH 2/4] sched: Fix race in idle_balance() |
| |
On Fri, Jan 17, 2014 at 10:04:02AM +0100, Daniel Lezcano wrote: > The scheduler main function 'schedule()' checks if there are no more tasks > on the runqueue. Then it checks if a task should be pulled in the current > runqueue in idle_balance() assuming it will go to idle otherwise. > > But the idle_balance() releases the rq->lock in order to lookup in the sched > domains and takes the lock again right after. That opens a window where > another cpu may put a task in our runqueue, so we won't go to idle but > we have filled the idle_stamp, thinking we will. > > This patch closes the window by checking if the runqueue has been modified > but without pulling a task after taking the lock again, so we won't go to idle > right after in the __schedule() function.
Did you actually observe this or was it found by reading the code?
| |