diff options
-rw-r--r-- | include/linux/perf_event.h | 2 | ||||
-rw-r--r-- | kernel/perf_event.c | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index f495c0147240..311b4dc785a1 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -938,9 +938,7 @@ struct perf_cpu_context { | |||
938 | struct list_head rotation_list; | 938 | struct list_head rotation_list; |
939 | int jiffies_interval; | 939 | int jiffies_interval; |
940 | struct pmu *active_pmu; | 940 | struct pmu *active_pmu; |
941 | #ifdef CONFIG_CGROUP_PERF | ||
942 | struct perf_cgroup *cgrp; | 941 | struct perf_cgroup *cgrp; |
943 | #endif | ||
944 | }; | 942 | }; |
945 | 943 | ||
946 | struct perf_output_handle { | 944 | struct perf_output_handle { |
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) | |||
941 | static void | 941 | static void |
942 | list_del_event(struct perf_event *event, struct perf_event_context *ctx) | 942 | list_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) |