[lkml]   [2010]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[102/123] sched: Fix rq->clock synchronization when migrating tasks
From: Peter Zijlstra <>

commit 861d034ee814917a83bd5de4b26e3b8336ddeeb8 upstream

sched_fork() -- we do task placement in ->task_fork_fair() ensure we
update_rq_clock() so we work with current time. We leave the vruntime
in relative state, so the time delay until wake_up_new_task() doesn't

wake_up_new_task() -- Since task_fork_fair() left p->vruntime in
relative state we can safely migrate, the activate_task() on the
remote rq will call update_rq_clock() and causes the clock to be
synced (enough).

Tested-by: Jack Daniel <>
Tested-by: Philby John <>
Signed-off-by: Peter Zijlstra <>
LKML-Reference: <1281002322.1923.1708.camel@laptop>
Signed-off-by: Ingo Molnar <>
Signed-off-by: Mike Galbraith <>
Signed-off-by: Greg Kroah-Hartman <>
kernel/sched_fair.c | 2 ++
1 file changed, 2 insertions(+)

--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1963,6 +1963,8 @@ static void task_fork_fair(struct task_s

spin_lock_irqsave(&rq->lock, flags);

+ update_rq_clock(rq);
if (unlikely(task_cpu(p) != this_cpu))
__set_task_cpu(p, this_cpu);

 \ /
  Last update: 2010-09-18 21:13    [W:0.302 / U:0.512 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site