All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] sched: add the other missing clock update to migrate_task()
@ 2009-11-22 12:11 Mike Galbraith
  2009-11-22 13:16 ` Peter Zijlstra
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Galbraith @ 2009-11-22 12:11 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar; +Cc: LKML


sched: add the other missing clock update to migrate_task()

When calling set_task_cpu(), we must update both runqueue clocks in order
to get an accurate clock offset.  Add it.


Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>

---
 kernel/sched.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -2126,6 +2126,7 @@ migrate_task(struct task_struct *p, int
 	 */
 	if (!p->se.on_rq && !task_running(rq, p)) {
 		update_rq_clock(rq);
+		update_rq_clock(cpu_rq(dest_cpu));
 		set_task_cpu(p, dest_cpu);
 		return 0;
 	}



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] sched: add the other missing clock update to migrate_task()
  2009-11-22 12:11 [patch] sched: add the other missing clock update to migrate_task() Mike Galbraith
@ 2009-11-22 13:16 ` Peter Zijlstra
  2009-11-22 16:58   ` Mike Galbraith
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2009-11-22 13:16 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Ingo Molnar, LKML

On Sun, 2009-11-22 at 13:11 +0100, Mike Galbraith wrote:
> sched: add the other missing clock update to migrate_task()
> 
> When calling set_task_cpu(), we must update both runqueue clocks in order
> to get an accurate clock offset.  Add it.
> 
> 
> Signed-off-by: Mike Galbraith <efault@gmx.de>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> LKML-Reference: <new-submission>
> 
> ---
>  kernel/sched.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: linux-2.6/kernel/sched.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched.c
> +++ linux-2.6/kernel/sched.c
> @@ -2126,6 +2126,7 @@ migrate_task(struct task_struct *p, int
>  	 */
>  	if (!p->se.on_rq && !task_running(rq, p)) {
>  		update_rq_clock(rq);
> +		update_rq_clock(cpu_rq(dest_cpu));
>  		set_task_cpu(p, dest_cpu);
>  		return 0;
>  	}


We should make double_rq_lock() and double_lock_balance() behave
equivalent wrt update_rq_clock().

Current, depending on CONFIG_PREEMPT, double_lock_balance() already
updates both rq clocks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] sched: add the other missing clock update to migrate_task()
  2009-11-22 13:16 ` Peter Zijlstra
@ 2009-11-22 16:58   ` Mike Galbraith
  2009-11-22 18:14     ` Mike Galbraith
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Galbraith @ 2009-11-22 16:58 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, LKML

On Sun, 2009-11-22 at 14:16 +0100, Peter Zijlstra wrote:

> We should make double_rq_lock() and double_lock_balance() behave
> equivalent wrt update_rq_clock().
> 
> Current, depending on CONFIG_PREEMPT, double_lock_balance() already
> updates both rq clocks.

Hm, right.  Better plan.  We can save an update in the wakeup path for
the tasks racing for the wakeup case too.  If the call is really a
lock/unlock go away, we don't need to bother.  Shave a ns or so.

	-Mike


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] sched: add the other missing clock update to migrate_task()
  2009-11-22 16:58   ` Mike Galbraith
@ 2009-11-22 18:14     ` Mike Galbraith
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Galbraith @ 2009-11-22 18:14 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, LKML

On Sun, 2009-11-22 at 17:58 +0100, Mike Galbraith wrote:
> On Sun, 2009-11-22 at 14:16 +0100, Peter Zijlstra wrote:
> 
> > We should make double_rq_lock() and double_lock_balance() behave
> > equivalent wrt update_rq_clock().
> > 
> > Current, depending on CONFIG_PREEMPT, double_lock_balance() already
> > updates both rq clocks.
> 
> Hm, right.  Better plan.

Oops, nope.  Consistency is still a good plan, however, that update is
still needed, because it's the case where we're _not_ going to use the
migration thread.

	-Mike


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-22 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-22 12:11 [patch] sched: add the other missing clock update to migrate_task() Mike Galbraith
2009-11-22 13:16 ` Peter Zijlstra
2009-11-22 16:58   ` Mike Galbraith
2009-11-22 18:14     ` Mike Galbraith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.