aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 3472bb1a070c..0c714226ae0c 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -941,6 +941,7 @@ static void perf_group_attach(struct perf_event *event)
941static void 941static void
942list_del_event(struct perf_event *event, struct perf_event_context *ctx) 942list_del_event(struct perf_event *event, struct perf_event_context *ctx)
943{ 943{
944 struct perf_cpu_context *cpuctx;
944 /* 945 /*
945 * We can have double detach due to exit/hot-unplug + close. 946 * We can have double detach due to exit/hot-unplug + close.
946 */ 947 */
@@ -949,8 +950,17 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
949 950
950 event->attach_state &= ~PERF_ATTACH_CONTEXT; 951 event->attach_state &= ~PERF_ATTACH_CONTEXT;
951 952
952 if (is_cgroup_event(event)) 953 if (is_cgroup_event(event)) {
953 ctx->nr_cgroups--; 954 ctx->nr_cgroups--;
955 cpuctx = __get_cpu_context(ctx);
956 /*
957 * if there are no more cgroup events
958 * then cler cgrp to avoid stale pointer
959 * in update_cgrp_time_from_cpuctx()
960 */
961 if (!ctx->nr_cgroups)
962 cpuctx->cgrp = NULL;
963 }
954 964
955 ctx->nr_events--; 965 ctx->nr_events--;
956 if (event->attr.inherit_stat) 966 if (event->attr.inherit_stat)