perf_event: Clean up perf_event_init_task()
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Fri, 25 Sep 2009 05:54:01 +0000 (13:54 +0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 1 Oct 2009 07:30:44 +0000 (09:30 +0200)
While at it: we can traverse ctx->group_list to get all
group leader, it should be safe since we hold ctx->mutex.

Changlog v1->v2:

  - remove WARN_ON_ONCE() according to Peter Zijlstra's suggestion

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <4ABC5AF9.6060808@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_event.c

index e50543db642a25a9256f0925b9f596e792444097..e491fb0879398b23a6951f7ea4c11f804e4e8eb4 100644 (file)
@@ -4767,9 +4767,7 @@ int perf_event_init_task(struct task_struct *child)
         * We dont have to disable NMIs - we are only looking at
         * the list, not manipulating it:
         */
-       list_for_each_entry_rcu(event, &parent_ctx->event_list, event_entry) {
-               if (event != event->group_leader)
-                       continue;
+       list_for_each_entry(event, &parent_ctx->group_list, group_entry) {
 
                if (!event->attr.inherit) {
                        inherited_all = 0;