mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf,core: do no try to schedule task events if there are none.
@ 2011-11-22 14:08 Gleb Natapov
  2011-11-22 14:12 ` Peter Zijlstra
  2011-12-07 15:44 ` [tip:perf/urgent] perf: Do " tip-bot for Gleb Natapov
  0 siblings, 2 replies; 3+ messages in thread
From: Gleb Natapov @ 2011-11-22 14:08 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-kernel

perf_event_sched_in() shouldn't try to schedule task events if there
are none otherwise task's ctx->is_active will be set and will not be
cleared during sched_out. This will prevent newly added events from
being scheduled into the task context.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

The patch is against tip/perf/urgent since it depends on commit
1d5f003f5a9 there.  I've sent updated version of above commit earlier but
unfortunately old version was applied and I do not see amended version
in Peter's queue either. So here is incremental fix.

diff --git a/kernel/events/core.c b/kernel/events/core.c
index b0c1186..920314e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2171,11 +2171,11 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
 	 */
 	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 
-	perf_event_sched_in(cpuctx, ctx, task);
-
 	if (ctx->nr_events)
 		cpuctx->task_ctx = ctx;
 
+	perf_event_sched_in(cpuctx, cpuctx->task_ctx, task);
+
 	perf_pmu_enable(ctx->pmu);
 	perf_ctx_unlock(cpuctx, ctx);
 
--
			Gleb.

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

* Re: [PATCH] perf,core: do no try to schedule task events if there are none.
  2011-11-22 14:08 [PATCH] perf,core: do no try to schedule task events if there are none Gleb Natapov
@ 2011-11-22 14:12 ` Peter Zijlstra
  2011-12-07 15:44 ` [tip:perf/urgent] perf: Do " tip-bot for Gleb Natapov
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2011-11-22 14:12 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Ingo Molnar, linux-kernel

On Tue, 2011-11-22 at 16:08 +0200, Gleb Natapov wrote:
> The patch is against tip/perf/urgent since it depends on commit
> 1d5f003f5a9 there.  I've sent updated version of above commit earlier but
> unfortunately old version was applied and I do not see amended version
> in Peter's queue either. So here is incremental fix.

Ah, sorry for messing that up, I did pick up the new version, but must
have crossed wires with Ingo merging and I failed to double check which
version ended up in the tree.

Thanks!

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

* [tip:perf/urgent] perf: Do no try to schedule task events if there are none
  2011-11-22 14:08 [PATCH] perf,core: do no try to schedule task events if there are none Gleb Natapov
  2011-11-22 14:12 ` Peter Zijlstra
@ 2011-12-07 15:44 ` tip-bot for Gleb Natapov
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Gleb Natapov @ 2011-12-07 15:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, gleb, hpa, mingo, a.p.zijlstra, tglx, mingo

Commit-ID:  86b47c25494b824da655b95f6fdb4fdb3f17aa77
Gitweb:     http://git.kernel.org/tip/86b47c25494b824da655b95f6fdb4fdb3f17aa77
Author:     Gleb Natapov <gleb@redhat.com>
AuthorDate: Tue, 22 Nov 2011 16:08:21 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 7 Dec 2011 16:31:22 +0100

perf: Do no try to schedule task events if there are none

perf_event_sched_in() shouldn't try to schedule task events if there
are none otherwise task's ctx->is_active will be set and will not be
cleared during sched_out. This will prevent newly added events from
being scheduled into the task context.

Fixes a boo-boo in commit 1d5f003f5a9 ("perf: Do not set task_ctx
pointer in cpuctx if there are no events in the context").

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111122140821.GF2557@redhat.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/events/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 600c162..d3b9df5 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2174,11 +2174,11 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
 	 */
 	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 
-	perf_event_sched_in(cpuctx, ctx, task);
-
 	if (ctx->nr_events)
 		cpuctx->task_ctx = ctx;
 
+	perf_event_sched_in(cpuctx, cpuctx->task_ctx, task);
+
 	perf_pmu_enable(ctx->pmu);
 	perf_ctx_unlock(cpuctx, ctx);
 

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

end of thread, other threads:[~2011-12-07 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 14:08 [PATCH] perf,core: do no try to schedule task events if there are none Gleb Natapov
2011-11-22 14:12 ` Peter Zijlstra
2011-12-07 15:44 ` [tip:perf/urgent] perf: Do " tip-bot for Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome