perf/core: Fix RCU problem with cgroup context switching code
commitddaaf4e291dd63db0667991e4a335fcf3a7df13e
authorStephane Eranian <eranian@google.com>
Thu, 12 Nov 2015 10:00:03 +0000 (12 11:00 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 23 Nov 2015 08:21:03 +0000 (23 09:21 +0100)
tree844099db01306e6badb1cd9bc867e19263547812
parent1ec218373b8ebda821aec00bb156a9c94fad9cd4
perf/core: Fix RCU problem with cgroup context switching code

The RCU checker detected RCU violation in the cgroup switching routines
perf_cgroup_sched_in() and perf_cgroup_sched_out(). We were dereferencing
cgroup from task without holding the RCU lock.

Fix this by holding the RCU read lock. We move the locking from
perf_cgroup_switch() to avoid double locking.

Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: edumazet@google.com
Link: http://lkml.kernel.org/r/1447322404-10920-2-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c