]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sched: only update rq->clock while holding rq->lock
authorPeter Zijlstra <peterz@infradead.org>
Wed, 15 Oct 2008 18:37:23 +0000 (20:37 +0200)
committerIngo Molnar <mingo@elte.hu>
Wed, 15 Oct 2008 18:43:27 +0000 (20:43 +0200)
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>
kernel/sched.c

index 6f230596bd0c1d21a2c68ffbff8207e93dcd65b5..c530b84c7f80de1225cb8d244a220adf3b817af5 100644 (file)
@@ -4441,12 +4441,8 @@ need_resched_nonpreemptible:
        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)) {