[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19129.38627.94363.857137@cargo.ozlabs.ibm.com>
Date: Wed, 23 Sep 2009 13:32:51 +1000
From: Paul Mackerras <paulus@...ba.org>
To: Xiao Guangrong <xiaoguangrong@...fujitsu.com>
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists