* sched: only update rq->clock while holding rq->lock
@ 2008-10-15 18:37 Peter Zijlstra
2008-10-16 2:32 ` Srivatsa Vaddagiri
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2008-10-15 18:37 UTC (permalink / raw)
To: Ingo Molnar; +Cc: vatsa, linux-kernel, Dhaval Giani, Balbir Singh
Vatsa,
you said someone would send a patch to this effect, I don't want to
steal credit, but I think this patch is better posted sooner rather than
later.
---
Subject: sched: only update rq->clock while holding rq->lock
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Wed Oct 15 20:30:26 CEST 2008
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>
---
kernel/sched.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -4448,12 +4448,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)) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sched: only update rq->clock while holding rq->lock
2008-10-15 18:37 sched: only update rq->clock while holding rq->lock Peter Zijlstra
@ 2008-10-16 2:32 ` Srivatsa Vaddagiri
2008-10-16 8:29 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Srivatsa Vaddagiri @ 2008-10-16 2:32 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Ingo Molnar, linux-kernel, Dhaval Giani, Balbir Singh, shaggy,
brking
On Wed, Oct 15, 2008 at 08:37:23PM +0200, Peter Zijlstra wrote:
> Vatsa noticed rq->clock going funny and tracked it down to an update_rq_clock()
> outside a rq->lock section.
For the records, actually Brian King and David Kleikamp noticed this!
--
Regards,
vatsa
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sched: only update rq->clock while holding rq->lock
2008-10-16 2:32 ` Srivatsa Vaddagiri
@ 2008-10-16 8:29 ` Peter Zijlstra
0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2008-10-16 8:29 UTC (permalink / raw)
To: vatsa; +Cc: Ingo Molnar, linux-kernel, Dhaval Giani, Balbir Singh, shaggy,
brking
On Thu, 2008-10-16 at 08:02 +0530, Srivatsa Vaddagiri wrote:
> On Wed, Oct 15, 2008 at 08:37:23PM +0200, Peter Zijlstra wrote:
> > Vatsa noticed rq->clock going funny and tracked it down to an update_rq_clock()
> > outside a rq->lock section.
>
> For the records, actually Brian King and David Kleikamp noticed this!
Thanks Brian and Shaggy!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-16 8:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-15 18:37 sched: only update rq->clock while holding rq->lock Peter Zijlstra
2008-10-16 2:32 ` Srivatsa Vaddagiri
2008-10-16 8:29 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox