OSDN Git Service

perf/core: Fix event cgroup tracking
authorPeter Zijlstra <peterz@infradead.org>
Wed, 18 Mar 2020 19:33:37 +0000 (20:33 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 8 Apr 2020 09:33:44 +0000 (11:33 +0200)
commit33238c50451596be86db1505ab65fee5172844d0
treed4c3d4cdd35ddbbef62ad7854157fa77c576fd21
parentf5e94d10e4c468357019e5c28d48499f677b284f
perf/core: Fix event cgroup tracking

Song reports that installing cgroup events is broken since:

  db0503e4f675 ("perf/core: Optimize perf_install_in_event()")

The problem being that cgroup events try to track cpuctx->cgrp even
for disabled events, which is pointless and actively harmful since the
above commit. Rework the code to have explicit enable/disable hooks
for cgroup events, such that we can limit cgroup tracking to active
events.

More specifically, since the above commit disabled events are no
longer added to their context from the 'right' CPU, and we can't
access things like the current cgroup for a remote CPU.

Cc: <stable@vger.kernel.org> # v5.5+
Fixes: db0503e4f675 ("perf/core: Optimize perf_install_in_event()")
Reported-by: Song Liu <songliubraving@fb.com>
Tested-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20200318193337.GB20760@hirez.programming.kicks-ass.net
kernel/events/core.c