[PATCH] sched: Avoid redundant trace_sched_migrate_task from sched_fork path.

From: Srikar Dronamraju
Date: Fri Mar 08 2013 - 02:40:50 EST


On fork/clone, trace_sched_migrate_task gets called twice. The first call
tries to record the migration with the parent pid and the migration seems to
be from the current cpu to the same current cpu. Also the numbers from
sched:sched_migrate_task and migrations events may vary.

Avoid duplicate migrate traces by calling __set_task_cpu instead of
set_task_cpu.

Signed-off-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>
---
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 26058d0..bf1e62d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1660,7 +1660,7 @@ void sched_fork(struct task_struct *p)
* Silence PROVE_RCU.
*/
raw_spin_lock_irqsave(&p->pi_lock, flags);
- set_task_cpu(p, cpu);
+ __set_task_cpu(p, cpu);
raw_spin_unlock_irqrestore(&p->pi_lock, flags);

#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)

--
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/