History

perf/core: Remove invalid warning from list_update_cgroup_even()t

The warning introduced in commit: 864c2357ca89 ("perf/core: Do not set cpuctx->cgrp for unscheduled cgroups") assumed that a cgroup switch always precedes list_del_event. This is not the case. Remove warning. Make sure that cpuctx->cgrp is NULL until a cgroup event is sched in or ctx->nr_cgroups == 0.

David Carrillo-Cisneros committed 9 years ago

Commit 8fc31ce1 parent 7f612a71 file · +8 −11Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/events/core.c+8−11
@@ -903,17 +903,14 @@ list_update_cgroup_event(struct perf_event *event, · 902 unmodified lines
903903 */
904904 cpuctx = __get_cpu_context(ctx);
905905
906− /* Only set/clear cpuctx->cgrp if current task uses event->cgrp. */
907− if (perf_cgroup_from_task(current, ctx) != event->cgrp) {
908− /*
909− * We are removing the last cpu event in this context.
910− * If that event is not active in this cpu, cpuctx->cgrp
911− * should've been cleared by perf_cgroup_switch.
912− */
913− WARN_ON_ONCE(!add && cpuctx->cgrp);
914− return;
915− }
916− cpuctx->cgrp = add ? event->cgrp : NULL;
906+ /*
907+ * cpuctx->cgrp is NULL until a cgroup event is sched in or
908+ * ctx->nr_cgroup == 0 .
909+ */
910+ if (add && perf_cgroup_from_task(current, ctx) == event->cgrp)
911+ cpuctx->cgrp = event->cgrp;
912+ else if (!add)
913+ cpuctx->cgrp = NULL;
917914 }
918915
919916 #else /* !CONFIG_CGROUP_PERF */