Skip to content

Commit cbc34ed

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
sched: fix tracepoints in scheduler
The trace point only caught one of many places where a task changes cpu, put it in the right place to we get all of them. Change the signature while we're at it. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent f3134de commit cbc34ed

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎include/trace/sched.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ DECLARE_TRACE(sched_switch,
3030
TPARGS(rq, prev, next));
3131

3232
DECLARE_TRACE(sched_migrate_task,
33-
TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu),
34-
TPARGS(rq, p, dest_cpu));
33+
TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
34+
TPARGS(p, orig_cpu, dest_cpu));
3535

3636
DECLARE_TRACE(sched_process_free,
3737
TPPROTO(struct task_struct *p),

‎kernel/sched.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
18511851

18521852
clock_offset = old_rq->clock - new_rq->clock;
18531853

1854+
trace_sched_migrate_task(p, task_cpu(p), new_cpu);
1855+
18541856
#ifdef CONFIG_SCHEDSTATS
18551857
if (p->se.wait_start)
18561858
p->se.wait_start -= clock_offset;
@@ -2868,7 +2870,6 @@ static void sched_migrate_task(struct task_struct *p, int dest_cpu)
28682870
|| unlikely(!cpu_active(dest_cpu)))
28692871
goto out;
28702872

2871-
trace_sched_migrate_task(rq, p, dest_cpu);
28722873
/* force the process onto the specified CPU */
28732874
if (migrate_task(p, dest_cpu, &req)) {
28742875
/* Need to wait for migration thread (might exit: take ref). */

0 commit comments

Comments
 (0)