Messages in this thread | | | From | "Zhu, DengCheng" <> | Subject | RE: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec | Date | Wed, 23 Nov 2011 12:40:47 +0000 |
| |
在 2011年11月23日星期三,Peter Zijlstra <a.p.zijlstra@chello.nl> 写道: > On Wed, 2011-11-23 at 11:38 +0800, Deng-Cheng Zhu wrote: > >> + list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { >> + ret = event_enable_on_exec(event, ctx); >> + if (ret) >> + enabled = 1; >> + } >> + >> list_for_each_entry(event, &ctx->pinned_groups, group_entry) { >> ret = event_enable_on_exec(event, ctx); >> if (ret) > > This isn't correct either, in this case you should then remove the other > two iterations of pinned/flexible group lists. > > Also your use of list_for_each_entry_rcu() is incorrect, either you then > should also use rcu_read_lock(), or its not needed and not use the _rcu > list primitive at all. > > Now since event_list is modified under ctx->lock, and we hold that lock > no fancy stuff is needed and we can do without.
Ah, yes you are right. Thanks. Your following patch looks good except that event_entry should be used for ctx event_list, rather than group_entry. Tomorrow I'll test it and get back to you.
Deng-Cheng
> --- > Subject: perf: Fix enable_on_exec for sibling events > From: Peter Zijlstra <a.p.zijlstra@chello.nl> > Date: Tue Nov 22 11:25:43 CET 2011 > > Deng-Cheng Zhu reported that sibling events that were created disabled > with enable_on_exec would never get enabled. Iterate all events instead > of the group lists. > > Reported-by: Deng-Cheng Zhu <dczhu@mips.com> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> > Link: http://lkml.kernel.org/n/tip-299rxrpmmle8hp3spyxfo202@git.kernel.org > --- > kernel/events/core.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > Index: linux-2.6/kernel/events/core.c > =================================================================== > --- linux-2.6.orig/kernel/events/core.c > +++ linux-2.6/kernel/events/core.c > @@ -2494,13 +2494,7 @@ static void perf_event_enable_on_exec(st > raw_spin_lock(&ctx->lock); > task_ctx_sched_out(ctx); > > - list_for_each_entry(event, &ctx->pinned_groups, group_entry) { > - ret = event_enable_on_exec(event, ctx); > - if (ret) > - enabled = 1; > - } > - > - list_for_each_entry(event, &ctx->flexible_groups, group_entry) { > + list_for_each_entry(event, &ctx->event_list, group_entry) { > ret = event_enable_on_exec(event, ctx); > if (ret) > enabled = 1; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >
| |