Skip to content

Commit

Permalink
sched: only update rq->clock while holding rq->lock
Browse files Browse the repository at this point in the history
Vatsa noticed rq->clock going funny and tracked it down to an update_rq_clock()
outside a rq->lock section.

This is a problem because things like double_rq_lock() update the rq->clock
value for both rqs. Therefore disabling interrupts isn't strong enough.

Reported-by: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Oct 15, 2008
1 parent 5b16a22 commit 8cd162c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4441,12 +4441,8 @@ asmlinkage void __sched schedule(void)
if (sched_feat(HRTICK))
hrtick_clear(rq);

/*
* Do the rq-clock update outside the rq lock:
*/
local_irq_disable();
spin_lock_irq(&rq->lock);
update_rq_clock(rq);
spin_lock(&rq->lock);
clear_tsk_need_resched(prev);

if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
Expand Down

0 comments on commit 8cd162c

Please sign in to comment.