perf: Fix exit() vs PERF_FORMAT_GROUP
commit03d7c94a14acd55388d9c5e50503c4969e0ba164
authorPeter Zijlstra <peterz@infradead.org>
Tue, 11 May 2010 09:51:53 +0000 (11 11:51 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:21:55 +0000 (5 11:21 -0700)
tree02162e8d54387d129a9120b09e6092a963e87e45
parent08959bab0e65a42ff0d10fde4982939b472a7a96
perf: Fix exit() vs PERF_FORMAT_GROUP

commit 050735b08ca8a016bbace4445fa025b88fee770b upstream.

Both Stephane and Corey reported that PERF_FORMAT_GROUP didn't
work as expected if the task the counters were attached to quit
before the read() call.

The cause is that we unconditionally destroy the grouping when
we remove counters from their context. Fix this by splitting off
the group destroy from the list removal such that
perf_event_remove_from_context() does not do this and change
perf_event_release() to do so.

Reported-by: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1273571513.5605.3527.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/perf_event.c