lkml.org 
[lkml]   [2010]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/12] perf: add perf_event_task_migrate()
Hello,

On 05/05/2010 07:08 AM, Frederic Weisbecker wrote:
>> /*
>> + * Called from scheduler set_task_cpu() to notify migration events.
>> + * If the task is moving to a different cpu, generate a migration sw
>> + * event.
>> + */
>> +void perf_event_task_migrate(struct task_struct *task, int new_cpu)
>> +{
>> + if (task_cpu(task) != new_cpu)
>> + perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
>> +}
>
> This needs to be static and inline (I haven't seem external users in this
> patchset).

Hmm... after the last patch, this one becomes a TP probe function
which can't be inlined.

> And we want it to be inlined because we save the caller address and the frame
> pointer from perf_sw_event(), and a new level of call is not wanted here.

Oh I see. So, to use it with TP, I would need increase the @skip
parameter to perf_fetch_caller_regs() somehow, right? Also, it
probably would be a good idea to add a comment w/ big fat warning to
perf_sw_event().

>> @@ -2084,11 +2084,10 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
>> #endif
>>
>> trace_sched_migrate_task(p, new_cpu);
>> + perf_event_task_migrate(p, new_cpu);
>>
>> - if (task_cpu(p) != new_cpu) {
>> + if (task_cpu(p) != new_cpu)
>
> In fact why not moving both tracing calls under this check.
> This is going to fix the migrate trace event that gets called
> even on "spurious" migrations, and you avoid the duplicate check
> in the perf callback.

Yeah, that would be my preferred choice too. I just didn't know that
could be changed. Cool. I'll.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2010-05-05 07:19    [W:0.135 / U:19.032 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site