diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-14 15:16:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-14 15:16:49 -0400 |
commit | 26c923ab196601011b6dd51088f47ed840e7b666 (patch) | |
tree | 0781b1ae1e97ecf11cd81d0973bd815db20a1c4b /kernel | |
parent | 60a6ca6c943bee3c76b5905e66d5fcd83ae8d34f (diff) | |
parent | 47a74bdcbfeff543f706dc0e385eebbb5d655ed2 (diff) | |
download | linux-26c923ab196601011b6dd51088f47ed840e7b666.tar.gz linux-26c923ab196601011b6dd51088f47ed840e7b666.tar.bz2 linux-26c923ab196601011b6dd51088f47ed840e7b666.zip |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"Some tooling fixes plus three kernel fixes: a memory leak fix, a
statistics fix and a crash fix"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/x86/intel/uncore: Fix memory leaks on allocation failures
perf/core: Fix cgroup time when scheduling descendants
perf/core: Avoid freeing static PMU contexts when PMU is unregistered
tools include uapi bpf.h: Sync kernel ABI header with tooling header
perf pmu: Unbreak perf record for arm/arm64 with events with explicit PMU
perf script: Add missing separator for "-F ip,brstack" (and brstackoff)
perf callchain: Compare dsos (as well) for CCKEY_FUNCTION
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/core.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 6bc21e202ae4..9d93db81fa36 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -662,7 +662,7 @@ static inline void update_cgrp_time_from_event(struct perf_event *event) /* * Do not update time when cgroup is not active */ - if (cgrp == event->cgrp) + if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup)) __update_cgrp_time(event->cgrp); } @@ -8955,6 +8955,14 @@ static struct perf_cpu_context __percpu *find_pmu_context(int ctxn) static void free_pmu_context(struct pmu *pmu) { + /* + * Static contexts such as perf_sw_context have a global lifetime + * and may be shared between different PMUs. Avoid freeing them + * when a single PMU is going away. + */ + if (pmu->task_ctx_nr > perf_invalid_context) + return; + mutex_lock(&pmus_lock); free_percpu(pmu->pmu_cpu_context); mutex_unlock(&pmus_lock); |