Messages in this thread | | | Date | Wed, 23 Sep 2009 13:32:51 +1000 | From | Paul Mackerras <> | Subject | Re: [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.
| |