[PATCH] sched:

From: Peter Zijlstra
Date: Tue Dec 22 2009 - 09:42:13 EST


As demonstrated by Eric, we really need to call __set_task_cpu() early
in the fork() path to properly initialize the various task state --
specifically the cgroup state through set_task_rq().

[ we could probably fix this by explicitly calling __set_task_cpu() from
sched_fork(), but lets try that for the next cycle and simply revert
to the old behaviour for now. ]

Reported-by: Eric Paris <eparis@xxxxxxxxxx>
Tested-by: Eric Paris <eparis@xxxxxxxxxx>,
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
kernel/sched.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -2067,11 +2067,10 @@ void set_task_cpu(struct task_struct *p,

trace_sched_migrate_task(p, new_cpu);

- if (task_cpu(p) == new_cpu)
- return;
-
- p->se.nr_migrations++;
- perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
+ if (task_cpu(p) != new_cpu) {
+ p->se.nr_migrations++;
+ perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
+ }

__set_task_cpu(p, new_cpu);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/