lkml.org 
[lkml]   [2009]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf_counter: cleanup for __perf_event_sched_in()
Xiao Guangrong writes:

> I only find three places in __perf_event_sched_in/out, could you tell me
> where is the fourth place?

My mistake, it is just those three. I saw the list_for_each_entry_rcu
followed by if (event != event->group_leader) in perf_event_init_task
and missed the fact that it is iterating parent_ctx->event_list rather
than parent_ctx->group_list. But as you point out:

> I also noticed that all group leader is the top level of ctx->group_list,
> if I not missed, the perf_event_init_task() function can be optimized,
> like this:
>
> int perf_event_init_task(struct task_struct *child)
> {
> ......
> /* We can only look at parent_ctx->group_list to get group leader */
> list_for_each_entry_rcu(event, &parent_ctx->event_list, event_entry) {
> if (event != event->group_leader)
> continue;
> ......
> }
> ......
> }

we would in fact be better off using group_list rather than event_list
anyway. That should be safe since we hold parent_ctx->mutex.

> I'll fix those if you are not mind :-)

Please do. :)

Paul.


\
 
 \ /
  Last update: 2009-09-23 05:35    [W:0.070 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site