2014-04-03 12:15:05

by Dongsheng Yang

[permalink] [raw]
Subject: [PATCH] sched: fix tracepoint in scheduler.

In function set_task_cpu(), if cpu == new_cpu,
there is no migration happen. But current trace point
will raise a migration trace event.

This patch change trace point to right place,
only when migration really happen, an event will
be threw out.

Signed-off-by: Dongsheng Yang <[email protected]>
---
kernel/sched/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9cae286..6708aff 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -998,9 +998,8 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
#endif
#endif

- trace_sched_migrate_task(p, new_cpu);
-
if (task_cpu(p) != new_cpu) {
+ trace_sched_migrate_task(p, new_cpu);
if (p->sched_class->migrate_task_rq)
p->sched_class->migrate_task_rq(p, new_cpu);
p->se.nr_migrations++;
--
1.8.2.1


2014-04-03 14:18:47

by Rik van Riel

[permalink] [raw]
Subject: Re: [PATCH] sched: fix tracepoint in scheduler.

On 04/03/2014 08:12 AM, Dongsheng Yang wrote:
> In function set_task_cpu(), if cpu == new_cpu,
> there is no migration happen. But current trace point
> will raise a migration trace event.
>
> This patch change trace point to right place,
> only when migration really happen, an event will
> be threw out.
>
> Signed-off-by: Dongsheng Yang <[email protected]>

I don't see any obvious place where set_task_cpu is called
with cpu == new_cpu, but there might be an un-obvious place,
because that if looks like it's there for a reason :)

Acked-by: Rik van Riel <[email protected]>

--
All rights reversed

2014-04-04 12:52:54

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] sched: fix tracepoint in scheduler.

On Thu, Apr 03, 2014 at 08:12:48PM +0800, Dongsheng Yang wrote:
> In function set_task_cpu(), if cpu == new_cpu,
> there is no migration happen. But current trace point
> will raise a migration trace event.
>
> This patch change trace point to right place,
> only when migration really happen, an event will
> be threw out.

Yeah its there so we can see pointless 'migrations'.