All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: deliver sched_switch events to a current task
@ 2012-07-12 10:14 Andrew Vagin
  2012-07-12 13:56 ` Peter Zijlstra
  2012-07-26 15:10 ` [tip:perf/core] sched: Deliver sched_switch events to the " tip-bot for Andrew Vagin
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Vagin @ 2012-07-12 10:14 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, Andrew Vagin, Ingo Molnar, Peter Zijlstra,
	Thomas Gleixner, Steven Rostedt, Arun Sharma

Otherwise they can't be filtered for a defined task.

perf record -e sched:sched_switch ./foo

This command doesn't report any event without this patch.

I think it isn't a big problem for security, if someone will know
who will be executed next. By default perf is disabled for non-root
users.

I need this events for profiling sleep times.  sched_switch is used for
getting callchains and sched_stat_* is used for getting time periods.
This events are combined in user space, then it can be analized by
perf tools.

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arun Sharma <asharma@fb.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
---
 kernel/sched/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d5594a4..c5d6a0f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1910,12 +1910,12 @@ static inline void
 prepare_task_switch(struct rq *rq, struct task_struct *prev,
 		    struct task_struct *next)
 {
+	trace_sched_switch(prev, next);
 	sched_info_switch(prev, next);
 	perf_event_task_sched_out(prev, next);
 	fire_sched_out_preempt_notifiers(prev, next);
 	prepare_lock_switch(rq, next);
 	prepare_arch_switch(next);
-	trace_sched_switch(prev, next);
 }
 
 /**
-- 
1.7.1


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

* Re: [PATCH] sched: deliver sched_switch events to a current task
  2012-07-12 10:14 [PATCH] sched: deliver sched_switch events to a current task Andrew Vagin
@ 2012-07-12 13:56 ` Peter Zijlstra
  2012-07-26 15:10 ` [tip:perf/core] sched: Deliver sched_switch events to the " tip-bot for Andrew Vagin
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2012-07-12 13:56 UTC (permalink / raw)
  To: Andrew Vagin
  Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, Steven Rostedt, Arun Sharma

On Thu, 2012-07-12 at 14:14 +0400, Andrew Vagin wrote:
> Otherwise they can't be filtered for a defined task.
> 
> perf record -e sched:sched_switch ./foo
> 
> This command doesn't report any event without this patch.
> 
> I think it isn't a big problem for security, if someone will know
> who will be executed next. By default perf is disabled for non-root
> users.
> 
> I need this events for profiling sleep times.  sched_switch is used for
> getting callchains and sched_stat_* is used for getting time periods.
> This events are combined in user space, then it can be analized by
> perf tools. 

Thanks!

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

* [tip:perf/core] sched: Deliver sched_switch events to the current task
  2012-07-12 10:14 [PATCH] sched: deliver sched_switch events to a current task Andrew Vagin
  2012-07-12 13:56 ` Peter Zijlstra
@ 2012-07-26 15:10 ` tip-bot for Andrew Vagin
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Andrew Vagin @ 2012-07-26 15:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, avagin, rostedt, tglx, asharma

Commit-ID:  895dd92c032e1604aa0d7afaef7716e058343b67
Gitweb:     http://git.kernel.org/tip/895dd92c032e1604aa0d7afaef7716e058343b67
Author:     Andrew Vagin <avagin@openvz.org>
AuthorDate: Thu, 12 Jul 2012 14:14:29 +0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 26 Jul 2012 12:23:10 +0200

sched: Deliver sched_switch events to the current task

Otherwise they can't be filtered for a defined task:

  perf record -e sched:sched_switch ./foo

This command doesn't report any events without this patch.

I think it isn't a security concern if someone knows who will
be executed next - this can already be observed by polling /proc
state. By default perf is disabled for non-root users in any case.

I need these events for profiling sleep times.  sched_switch is used for
getting callchains and sched_stat_* is used for getting time periods.
These events are combined in user space, then it can be analyzed by
perf tools.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arun Sharma <asharma@fb.com>
Link: http://lkml.kernel.org/r/1342088069-1005148-1-git-send-email-avagin@openvz.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 468bdd4..ad732b5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1910,12 +1910,12 @@ static inline void
 prepare_task_switch(struct rq *rq, struct task_struct *prev,
 		    struct task_struct *next)
 {
+	trace_sched_switch(prev, next);
 	sched_info_switch(prev, next);
 	perf_event_task_sched_out(prev, next);
 	fire_sched_out_preempt_notifiers(prev, next);
 	prepare_lock_switch(rq, next);
 	prepare_arch_switch(next);
-	trace_sched_switch(prev, next);
 }
 
 /**

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

end of thread, other threads:[~2012-07-26 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12 10:14 [PATCH] sched: deliver sched_switch events to a current task Andrew Vagin
2012-07-12 13:56 ` Peter Zijlstra
2012-07-26 15:10 ` [tip:perf/core] sched: Deliver sched_switch events to the " tip-bot for Andrew Vagin

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.