All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: Do not send exit event twice
@ 2015-11-04 15:00 Jiri Olsa
  2015-11-04 15:46 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jiri Olsa @ 2015-11-04 15:00 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Arnaldo Carvalho de Melo

In case we monitor events system wide, we get EXIT event
(when configured) twice for each task that exited.

Note doubled lines with same pid/tid in following example:

  $ sudo ./perf record -a
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.480 MB perf.data (2518 samples) ]
  $ sudo ./perf report -D | grep EXIT

  0 60290687567581 0x59910 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687568354 0x59948 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687988744 0x59ad8 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687989198 0x59b10 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  1 60290692567895 0x62af0 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  1 60290692568322 0x62b28 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  2 60290692739276 0x69a18 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)
  2 60290692739910 0x69a50 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)

The reason is that the cpu contexts are processes each time
we call perf_event_task. I'm changing the perf_event_aux logic
to serve task_ctx and cpu contexts separately, which ensure we
don't get EXIT event generated twice on same cpu context.

This does not affect other auxiliary events, as they don't
use task_ctx at all.

Link: http://lkml.kernel.org/n/tip-fghxh2gucaa7wyp1edjtvssd@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 kernel/events/core.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index ea02109aee77..470d6eaef576 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5661,6 +5661,17 @@ perf_event_aux_ctx(struct perf_event_context *ctx,
 }
 
 static void
+perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data,
+			struct perf_event_context *task_ctx)
+{
+	rcu_read_lock();
+	preempt_disable();
+	perf_event_aux_ctx(task_ctx, output, data);
+	preempt_enable();
+	rcu_read_unlock();
+}
+
+static void
 perf_event_aux(perf_event_aux_output_cb output, void *data,
 	       struct perf_event_context *task_ctx)
 {
@@ -5669,14 +5680,23 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
 	struct pmu *pmu;
 	int ctxn;
 
+	/*
+	 * If we have task_ctx != NULL we only notify
+	 * the task context itself. The task_ctx is set
+	 * only for EXIT events before releasing task
+	 * context.
+	 */
+	if (task_ctx) {
+		perf_event_aux_task_ctx(output, data, task_ctx);
+		return;
+	}
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
 		if (cpuctx->unique_pmu != pmu)
 			goto next;
 		perf_event_aux_ctx(&cpuctx->ctx, output, data);
-		if (task_ctx)
-			goto next;
 		ctxn = pmu->task_ctx_nr;
 		if (ctxn < 0)
 			goto next;
@@ -5686,12 +5706,6 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
 next:
 		put_cpu_ptr(pmu->pmu_cpu_context);
 	}
-
-	if (task_ctx) {
-		preempt_disable();
-		perf_event_aux_ctx(task_ctx, output, data);
-		preempt_enable();
-	}
 	rcu_read_unlock();
 }
 
@@ -8777,10 +8791,8 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn)
 	struct perf_event_context *child_ctx, *clone_ctx = NULL;
 	unsigned long flags;
 
-	if (likely(!child->perf_event_ctxp[ctxn])) {
-		perf_event_task(child, NULL, 0);
+	if (likely(!child->perf_event_ctxp[ctxn]))
 		return;
-	}
 
 	local_irq_save(flags);
 	/*
@@ -8864,6 +8876,14 @@ void perf_event_exit_task(struct task_struct *child)
 
 	for_each_task_context_nr(ctxn)
 		perf_event_exit_task_context(child, ctxn);
+
+	/*
+	 * The perf_event_exit_task_context calls perf_event_task
+	 * with child's task_ctx, which generates EXIT events for
+	 * child contexts and sets child->perf_event_ctxp[] to NULL.
+	 * At this point we need to send EXIT events to cpu contexts.
+	 */
+	perf_event_task(child, NULL, 0);
 }
 
 static void perf_free_event(struct perf_event *event,
-- 
2.4.3


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

* Re: [PATCH] perf: Do not send exit event twice
  2015-11-04 15:00 [PATCH] perf: Do not send exit event twice Jiri Olsa
@ 2015-11-04 15:46 ` Peter Zijlstra
  2015-11-04 15:53   ` Jiri Olsa
  2015-12-04 11:51 ` [tip:perf/core] " tip-bot for Jiri Olsa
  2015-12-06 13:17 ` tip-bot for Jiri Olsa
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2015-11-04 15:46 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Arnaldo Carvalho de Melo

On Wed, Nov 04, 2015 at 04:00:05PM +0100, Jiri Olsa wrote:
> This does not affect other auxiliary events, as they don't
> use task_ctx at all.

FORK does..

> Link: http://lkml.kernel.org/n/tip-fghxh2gucaa7wyp1edjtvssd@git.kernel.org

Please fix your script to never emit /n/ links; those are no longer
appreciated.

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

* Re: [PATCH] perf: Do not send exit event twice
  2015-11-04 15:46 ` Peter Zijlstra
@ 2015-11-04 15:53   ` Jiri Olsa
  2015-11-04 16:03     ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Jiri Olsa @ 2015-11-04 15:53 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Jiri Olsa, lkml, David Ahern, Ingo Molnar, Namhyung Kim,
	Arnaldo Carvalho de Melo

On Wed, Nov 04, 2015 at 04:46:04PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 04, 2015 at 04:00:05PM +0100, Jiri Olsa wrote:
> > This does not affect other auxiliary events, as they don't
> > use task_ctx at all.
> 
> FORK does..

hum, I don't see that, it passes NULL as task_ctx:

void perf_event_fork(struct task_struct *task)
{
        perf_event_task(task, NULL, 1);
}


> 
> > Link: http://lkml.kernel.org/n/tip-fghxh2gucaa7wyp1edjtvssd@git.kernel.org
> 
> Please fix your script to never emit /n/ links; those are no longer
> appreciated.

will do

thanks.
jirka

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

* Re: [PATCH] perf: Do not send exit event twice
  2015-11-04 15:53   ` Jiri Olsa
@ 2015-11-04 16:03     ` Peter Zijlstra
  2015-11-26 19:37       ` Jiri Olsa
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2015-11-04 16:03 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, lkml, David Ahern, Ingo Molnar, Namhyung Kim,
	Arnaldo Carvalho de Melo

On Wed, Nov 04, 2015 at 04:53:58PM +0100, Jiri Olsa wrote:
> On Wed, Nov 04, 2015 at 04:46:04PM +0100, Peter Zijlstra wrote:
> > On Wed, Nov 04, 2015 at 04:00:05PM +0100, Jiri Olsa wrote:
> > > This does not affect other auxiliary events, as they don't
> > > use task_ctx at all.
> > 
> > FORK does..
> 
> hum, I don't see that, it passes NULL as task_ctx:
> 
> void perf_event_fork(struct task_struct *task)
> {
>         perf_event_task(task, NULL, 1);
> }

Bah, I'll go sit in a corner, or rather, have a nap. Clearly I cannot
even read anymore.

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

* Re: [PATCH] perf: Do not send exit event twice
  2015-11-04 16:03     ` Peter Zijlstra
@ 2015-11-26 19:37       ` Jiri Olsa
  0 siblings, 0 replies; 7+ messages in thread
From: Jiri Olsa @ 2015-11-26 19:37 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Jiri Olsa, lkml, David Ahern, Ingo Molnar, Namhyung Kim,
	Arnaldo Carvalho de Melo

On Wed, Nov 04, 2015 at 05:03:48PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 04, 2015 at 04:53:58PM +0100, Jiri Olsa wrote:
> > On Wed, Nov 04, 2015 at 04:46:04PM +0100, Peter Zijlstra wrote:
> > > On Wed, Nov 04, 2015 at 04:00:05PM +0100, Jiri Olsa wrote:
> > > > This does not affect other auxiliary events, as they don't
> > > > use task_ctx at all.
> > > 
> > > FORK does..
> > 
> > hum, I don't see that, it passes NULL as task_ctx:
> > 
> > void perf_event_fork(struct task_struct *task)
> > {
> >         perf_event_task(task, NULL, 1);
> > }
> 
> Bah, I'll go sit in a corner, or rather, have a nap. Clearly I cannot
> even read anymore.

heya,
can't see this one being in any queue so far.. could you please
take it together with:
  perf x86 intel: Fix INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_NA macro

thanks,
jirka

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

* [tip:perf/core] perf: Do not send exit event twice
  2015-11-04 15:00 [PATCH] perf: Do not send exit event twice Jiri Olsa
  2015-11-04 15:46 ` Peter Zijlstra
@ 2015-12-04 11:51 ` tip-bot for Jiri Olsa
  2015-12-06 13:17 ` tip-bot for Jiri Olsa
  2 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-12-04 11:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, dsahern, vincent.weaver, acme, eranian, mingo,
	linux-kernel, hpa, acme, torvalds, peterz, namhyung, jolsa,
	jolsa

Commit-ID:  b85da9c1e52eb570fc16a42ae241ee5039c9151b
Gitweb:     http://git.kernel.org/tip/b85da9c1e52eb570fc16a42ae241ee5039c9151b
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 4 Nov 2015 16:00:05 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 4 Dec 2015 10:08:07 +0100

perf: Do not send exit event twice

In case we monitor events system wide, we get EXIT event
(when configured) twice for each task that exited.

Note doubled lines with same pid/tid in following example:

  $ sudo ./perf record -a
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.480 MB perf.data (2518 samples) ]
  $ sudo ./perf report -D | grep EXIT

  0 60290687567581 0x59910 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687568354 0x59948 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687988744 0x59ad8 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687989198 0x59b10 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  1 60290692567895 0x62af0 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  1 60290692568322 0x62b28 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  2 60290692739276 0x69a18 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)
  2 60290692739910 0x69a50 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)

The reason is that the cpu contexts are processes each time
we call perf_event_task. I'm changing the perf_event_aux logic
to serve task_ctx and cpu contexts separately, which ensure we
don't get EXIT event generated twice on same cpu context.

This does not affect other auxiliary events, as they don't
use task_ctx at all.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/1446649205-5822-1-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/events/core.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 49a5118..39cf4a4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5683,6 +5683,17 @@ perf_event_aux_ctx(struct perf_event_context *ctx,
 }
 
 static void
+perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data,
+			struct perf_event_context *task_ctx)
+{
+	rcu_read_lock();
+	preempt_disable();
+	perf_event_aux_ctx(task_ctx, output, data);
+	preempt_enable();
+	rcu_read_unlock();
+}
+
+static void
 perf_event_aux(perf_event_aux_output_cb output, void *data,
 	       struct perf_event_context *task_ctx)
 {
@@ -5691,14 +5702,23 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
 	struct pmu *pmu;
 	int ctxn;
 
+	/*
+	 * If we have task_ctx != NULL we only notify
+	 * the task context itself. The task_ctx is set
+	 * only for EXIT events before releasing task
+	 * context.
+	 */
+	if (task_ctx) {
+		perf_event_aux_task_ctx(output, data, task_ctx);
+		return;
+	}
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
 		if (cpuctx->unique_pmu != pmu)
 			goto next;
 		perf_event_aux_ctx(&cpuctx->ctx, output, data);
-		if (task_ctx)
-			goto next;
 		ctxn = pmu->task_ctx_nr;
 		if (ctxn < 0)
 			goto next;
@@ -5708,12 +5728,6 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
 next:
 		put_cpu_ptr(pmu->pmu_cpu_context);
 	}
-
-	if (task_ctx) {
-		preempt_disable();
-		perf_event_aux_ctx(task_ctx, output, data);
-		preempt_enable();
-	}
 	rcu_read_unlock();
 }
 
@@ -8803,10 +8817,8 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn)
 	struct perf_event_context *child_ctx, *clone_ctx = NULL;
 	unsigned long flags;
 
-	if (likely(!child->perf_event_ctxp[ctxn])) {
-		perf_event_task(child, NULL, 0);
+	if (likely(!child->perf_event_ctxp[ctxn]))
 		return;
-	}
 
 	local_irq_save(flags);
 	/*
@@ -8890,6 +8902,14 @@ void perf_event_exit_task(struct task_struct *child)
 
 	for_each_task_context_nr(ctxn)
 		perf_event_exit_task_context(child, ctxn);
+
+	/*
+	 * The perf_event_exit_task_context calls perf_event_task
+	 * with child's task_ctx, which generates EXIT events for
+	 * child contexts and sets child->perf_event_ctxp[] to NULL.
+	 * At this point we need to send EXIT events to cpu contexts.
+	 */
+	perf_event_task(child, NULL, 0);
 }
 
 static void perf_free_event(struct perf_event *event,

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

* [tip:perf/core] perf: Do not send exit event twice
  2015-11-04 15:00 [PATCH] perf: Do not send exit event twice Jiri Olsa
  2015-11-04 15:46 ` Peter Zijlstra
  2015-12-04 11:51 ` [tip:perf/core] " tip-bot for Jiri Olsa
@ 2015-12-06 13:17 ` tip-bot for Jiri Olsa
  2 siblings, 0 replies; 7+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-12-06 13:17 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, hpa, dsahern, jolsa, tglx, mingo, jolsa, acme, eranian,
	linux-kernel, acme, vincent.weaver, torvalds, namhyung

Commit-ID:  4e93ad601a4308d4a67673c81556580817d56940
Gitweb:     http://git.kernel.org/tip/4e93ad601a4308d4a67673c81556580817d56940
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 4 Nov 2015 16:00:05 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 6 Dec 2015 12:54:49 +0100

perf: Do not send exit event twice

In case we monitor events system wide, we get EXIT event
(when configured) twice for each task that exited.

Note doubled lines with same pid/tid in following example:

  $ sudo ./perf record -a
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.480 MB perf.data (2518 samples) ]
  $ sudo ./perf report -D | grep EXIT

  0 60290687567581 0x59910 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687568354 0x59948 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687988744 0x59ad8 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  0 60290687989198 0x59b10 [0x38]: PERF_RECORD_EXIT(1250:1250):(1250:1250)
  1 60290692567895 0x62af0 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  1 60290692568322 0x62b28 [0x38]: PERF_RECORD_EXIT(1253:1253):(1253:1253)
  2 60290692739276 0x69a18 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)
  2 60290692739910 0x69a50 [0x38]: PERF_RECORD_EXIT(1252:1252):(1252:1252)

The reason is that the cpu contexts are processes each time
we call perf_event_task. I'm changing the perf_event_aux logic
to serve task_ctx and cpu contexts separately, which ensure we
don't get EXIT event generated twice on same cpu context.

This does not affect other auxiliary events, as they don't
use task_ctx at all.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/1446649205-5822-1-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/events/core.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 49a5118..39cf4a4 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5683,6 +5683,17 @@ perf_event_aux_ctx(struct perf_event_context *ctx,
 }
 
 static void
+perf_event_aux_task_ctx(perf_event_aux_output_cb output, void *data,
+			struct perf_event_context *task_ctx)
+{
+	rcu_read_lock();
+	preempt_disable();
+	perf_event_aux_ctx(task_ctx, output, data);
+	preempt_enable();
+	rcu_read_unlock();
+}
+
+static void
 perf_event_aux(perf_event_aux_output_cb output, void *data,
 	       struct perf_event_context *task_ctx)
 {
@@ -5691,14 +5702,23 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
 	struct pmu *pmu;
 	int ctxn;
 
+	/*
+	 * If we have task_ctx != NULL we only notify
+	 * the task context itself. The task_ctx is set
+	 * only for EXIT events before releasing task
+	 * context.
+	 */
+	if (task_ctx) {
+		perf_event_aux_task_ctx(output, data, task_ctx);
+		return;
+	}
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(pmu, &pmus, entry) {
 		cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
 		if (cpuctx->unique_pmu != pmu)
 			goto next;
 		perf_event_aux_ctx(&cpuctx->ctx, output, data);
-		if (task_ctx)
-			goto next;
 		ctxn = pmu->task_ctx_nr;
 		if (ctxn < 0)
 			goto next;
@@ -5708,12 +5728,6 @@ perf_event_aux(perf_event_aux_output_cb output, void *data,
 next:
 		put_cpu_ptr(pmu->pmu_cpu_context);
 	}
-
-	if (task_ctx) {
-		preempt_disable();
-		perf_event_aux_ctx(task_ctx, output, data);
-		preempt_enable();
-	}
 	rcu_read_unlock();
 }
 
@@ -8803,10 +8817,8 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn)
 	struct perf_event_context *child_ctx, *clone_ctx = NULL;
 	unsigned long flags;
 
-	if (likely(!child->perf_event_ctxp[ctxn])) {
-		perf_event_task(child, NULL, 0);
+	if (likely(!child->perf_event_ctxp[ctxn]))
 		return;
-	}
 
 	local_irq_save(flags);
 	/*
@@ -8890,6 +8902,14 @@ void perf_event_exit_task(struct task_struct *child)
 
 	for_each_task_context_nr(ctxn)
 		perf_event_exit_task_context(child, ctxn);
+
+	/*
+	 * The perf_event_exit_task_context calls perf_event_task
+	 * with child's task_ctx, which generates EXIT events for
+	 * child contexts and sets child->perf_event_ctxp[] to NULL.
+	 * At this point we need to send EXIT events to cpu contexts.
+	 */
+	perf_event_task(child, NULL, 0);
 }
 
 static void perf_free_event(struct perf_event *event,

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-04 15:00 [PATCH] perf: Do not send exit event twice Jiri Olsa
2015-11-04 15:46 ` Peter Zijlstra
2015-11-04 15:53   ` Jiri Olsa
2015-11-04 16:03     ` Peter Zijlstra
2015-11-26 19:37       ` Jiri Olsa
2015-12-04 11:51 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-12-06 13:17 ` tip-bot for Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.