linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/core: remove invalid warning from list_update_cgroup_event
@ 2016-12-04  8:46 David Carrillo-Cisneros
  2016-12-05  8:57 ` Peter Zijlstra
  2016-12-06 10:12 ` [tip:perf/urgent] perf/core: Remove invalid warning from list_update_cgroup_even()t tip-bot for David Carrillo-Cisneros
  0 siblings, 2 replies; 4+ messages in thread
From: David Carrillo-Cisneros @ 2016-12-04  8:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: x86, Ingo Molnar, Thomas Gleixner, Andi Kleen, Kan Liang,
	Peter Zijlstra, Vegard Nossum, Marcelo Tosatti, Nilay Vaish,
	Borislav Petkov, Vikas Shivappa, Ravi V Shankar, Fenghua Yu,
	Paul Turner, Stephane Eranian, David Carrillo-Cisneros

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.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 kernel/events/core.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6ee1feb..02c8421 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -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 */
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf/core: remove invalid warning from list_update_cgroup_event
  2016-12-04  8:46 [PATCH] perf/core: remove invalid warning from list_update_cgroup_event David Carrillo-Cisneros
@ 2016-12-05  8:57 ` Peter Zijlstra
  2016-12-05  9:42   ` David Carrillo-Cisneros
  2016-12-06 10:12 ` [tip:perf/urgent] perf/core: Remove invalid warning from list_update_cgroup_even()t tip-bot for David Carrillo-Cisneros
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2016-12-05  8:57 UTC (permalink / raw)
  To: David Carrillo-Cisneros
  Cc: linux-kernel, x86, Ingo Molnar, Thomas Gleixner, Andi Kleen,
	Kan Liang, Vegard Nossum, Marcelo Tosatti, Nilay Vaish,
	Borislav Petkov, Vikas Shivappa, Ravi V Shankar, Fenghua Yu,
	Paul Turner, Stephane Eranian

On Sun, Dec 04, 2016 at 12:46:17AM -0800, David Carrillo-Cisneros wrote:
> 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")

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf/core: remove invalid warning from list_update_cgroup_event
  2016-12-05  8:57 ` Peter Zijlstra
@ 2016-12-05  9:42   ` David Carrillo-Cisneros
  0 siblings, 0 replies; 4+ messages in thread
From: David Carrillo-Cisneros @ 2016-12-05  9:42 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, x86, Ingo Molnar, Thomas Gleixner, Andi Kleen,
	Kan Liang, Vegard Nossum, Marcelo Tosatti, Nilay Vaish,
	Borislav Petkov, Vikas Shivappa, Ravi V Shankar, Fenghua Yu,
	Paul Turner, Stephane Eranian

>> 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/urgent] perf/core: Remove invalid warning from list_update_cgroup_even()t
  2016-12-04  8:46 [PATCH] perf/core: remove invalid warning from list_update_cgroup_event David Carrillo-Cisneros
  2016-12-05  8:57 ` Peter Zijlstra
@ 2016-12-06 10:12 ` tip-bot for David Carrillo-Cisneros
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for David Carrillo-Cisneros @ 2016-12-06 10:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: fenghua.yu, tglx, mingo, torvalds, acme, peterz, linux-kernel,
	vincent.weaver, bp, vegard.nossum, eranian, jolsa, pjt,
	kan.liang, nilayvaish, mtosatti, vikas.shivappa,
	alexander.shishkin, ravi.v.shankar, hpa, davidcc

Commit-ID:  8fc31ce8896fc3cea1d79688c8ff950ad4e73afe
Gitweb:     http://git.kernel.org/tip/8fc31ce8896fc3cea1d79688c8ff950ad4e73afe
Author:     David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Sun, 4 Dec 2016 00:46:17 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
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.

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>
---
 kernel/events/core.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6ee1feb..02c8421 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -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 */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-06 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-04  8:46 [PATCH] perf/core: remove invalid warning from list_update_cgroup_event David Carrillo-Cisneros
2016-12-05  8:57 ` Peter Zijlstra
2016-12-05  9:42   ` David Carrillo-Cisneros
2016-12-06 10:12 ` [tip:perf/urgent] perf/core: Remove invalid warning from list_update_cgroup_even()t tip-bot for David Carrillo-Cisneros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).