Skip to content

Commit 8fc31ce

Browse files
David Carrillo-Cisnerosingomolnar
authored andcommitted
perf/core: Remove invalid warning from list_update_cgroup_even()t
The warning introduced in commit: 864c235 ("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. Signed-off-by: David Carrillo-Cisneros <davidcc@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Borislav Petkov <bp@suse.de> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kan Liang <kan.liang@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Nilay Vaish <nilayvaish@gmail.com> Cc: Paul Turner <pjt@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi V Shankar <ravi.v.shankar@intel.com> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vegard Nossum <vegard.nossum@gmail.com> Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com> Cc: Vince Weaver <vincent.weaver@maine.edu> Link: http://lkml.kernel.org/r/1480841177-27299-1-git-send-email-davidcc@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 7f612a7 commit 8fc31ce

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

kernel/events/core.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -903,17 +903,14 @@ list_update_cgroup_event(struct perf_event *event,
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 */

0 commit comments

Comments
 (0)