Skip to contentSkip to conversation

perf/core: remove invalid warning from list_update_cgroup_event

PATCH In review David Carrillo-Cisneros 3 participants 4 messages Dec 4, 2016 – Dec 6, 2016 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/core: remove invalid warning from list_update_cgroup_event

The warning introduced in commit:

979bfef8607c ("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.

---
 kernel/events/core.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
kernel/events/core.c +8 -11
index 6ee1feb..02c8421 100644
@@ -903,17 +903,14 @@ list_update_cgroup_event(struct perf_event *event,
 	 */
 	cpuctx = __get_cpu_context(ctx);
 
-	/* Only set/clear cpuctx->cgrp if current task uses event->cgrp. */
-	if (perf_cgroup_from_task(current, ctx) != event->cgrp) {
-		/*
-		 * We are removing the last cpu event in this context.
-		 * If that event is not active in this cpu, cpuctx->cgrp
-		 * should've been cleared by perf_cgroup_switch.
-		 */
-		WARN_ON_ONCE(!add && cpuctx->cgrp);
-		return;
-	}
-	cpuctx->cgrp = add ? event->cgrp : NULL;
+	/*
+	 * cpuctx->cgrp is NULL until a cgroup event is sched in or
+	 * ctx->nr_cgroup == 0 .
+	 */
+	if (add && perf_cgroup_from_task(current, ctx) == event->cgrp)
+		cpuctx->cgrp = event->cgrp;
+	else if (!add)
+		cpuctx->cgrp = NULL;
 }
 
 #else /* !CONFIG_CGROUP_PERF */
Signature · 1 line
2.8.0.rc3.226.g39d4020
maintainer
#1 lore raw
Quoted 3 lines · David Carrillo-Cisneros

The warning introduced in commit:

979bfef8607c ("perf/core: Do not set cpuctx->cgrp for unscheduled cgroups")

That commit doesn't exist.

You instead mean this one, right?

864c2357ca89 ("perf/core: Do not set cpuctx->cgrp for unscheduled cgroups")

#2 lore raw
Quoted 7 lines
Quoted 3 lines

The warning introduced in commit:

979bfef8607c ("perf/core: Do not set cpuctx->cgrp for unscheduled cgroups")

That commit doesn't exist.

You instead mean this one, right?

Ups, got it from the wrong tree. Yes, that's the one I meant.

Quoted 5 lines

864c2357ca89 ("perf/core: Do not set cpuctx->cgrp for unscheduled cgroups")

#3 lore raw

[tip:perf/urgent] perf/core: Remove invalid warning from list_update_cgroup_even()t

In reply to David Carrillo-Cisneros
perf/core: Remove invalid warning from list_update_cgroup_even()t
Commit-ID:  8fc31ce8896fc3cea1d79688c8ff950ad4e73afe
Gitweb:     http://git.kernel.org/tip/8fc31ce8896fc3cea1d79688c8ff950ad4e73afe
Author:     David Carrillo-Cisneros <[email protected]>
AuthorDate: Sun, 4 Dec 2016 00:46:17 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 6 Dec 2016 09:44:29 +0100

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.

Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Fenghua Yu <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Nilay Vaish <[email protected]>
Cc Paul Turner <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ravi V Shankar <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vegard Nossum <[email protected]>
Cc Vikas Shivappa <[email protected]>
Cc Vince Weaver <[email protected]>
---
 kernel/events/core.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
kernel/events/core.c +8 -11
index 6ee1feb..02c8421 100644
@@ -903,17 +903,14 @@ list_update_cgroup_event(struct perf_event *event,
 	 */
 	cpuctx = __get_cpu_context(ctx);
 
-	/* Only set/clear cpuctx->cgrp if current task uses event->cgrp. */
-	if (perf_cgroup_from_task(current, ctx) != event->cgrp) {
-		/*
-		 * We are removing the last cpu event in this context.
-		 * If that event is not active in this cpu, cpuctx->cgrp
-		 * should've been cleared by perf_cgroup_switch.
-		 */
-		WARN_ON_ONCE(!add && cpuctx->cgrp);
-		return;
-	}
-	cpuctx->cgrp = add ? event->cgrp : NULL;
+	/*
+	 * cpuctx->cgrp is NULL until a cgroup event is sched in or
+	 * ctx->nr_cgroup == 0 .
+	 */
+	if (add && perf_cgroup_from_task(current, ctx) == event->cgrp)
+		cpuctx->cgrp = event->cgrp;
+	else if (!add)
+		cpuctx->cgrp = NULL;
 }
 
 #else /* !CONFIG_CGROUP_PERF */