[PATCH 04/12] perf: add @rq to perf_event_task_sched_out()

Previous thread: [PATCH 02/12] sched: rename preempt_notifiers to sched_notifiers and refactor implementation by Tejun Heo on Tuesday, May 4, 2010 - 5:38 am. (1 message)

Next thread: [PATCH 03/12] perf: add perf_event_task_migrate() by Tejun Heo on Tuesday, May 4, 2010 - 5:38 am. (7 messages)
From: Tejun Heo
Date: Tuesday, May 4, 2010 - 5:38 am

Add @rq to perf_event_task_sched_out() so that its argument matches
those of trace_sched_switch().  This will help unifying notifiers in
sched.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 include/linux/perf_event.h |    5 +++--
 kernel/perf_event.c        |    4 ++--
 kernel/sched.c             |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index a5eec48..1e3c6c3 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -756,7 +756,8 @@ extern const struct pmu *hw_perf_event_init(struct perf_event *event);
 
 extern void perf_event_task_migrate(struct task_struct *task, int new_cpu);
 extern void perf_event_task_sched_in(struct task_struct *task);
-extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
+extern void perf_event_task_sched_out(struct rq *rq, struct task_struct *task,
+				      struct task_struct *next);
 extern void perf_event_task_tick(struct task_struct *task);
 extern int perf_event_init_task(struct task_struct *child);
 extern void perf_event_exit_task(struct task_struct *child);
@@ -954,7 +955,7 @@ perf_event_task_migrate(struct task_struct *task, int new_cpu)		{ }
 static inline void
 perf_event_task_sched_in(struct task_struct *task)			{ }
 static inline void
-perf_event_task_sched_out(struct task_struct *task,
+perf_event_task_sched_out(struct rq *rq, struct task_struct *task,
 			    struct task_struct *next)			{ }
 static inline void
 perf_event_task_tick(struct task_struct *task)				{ }
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index a01ba31..73e2c1c 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1169,8 +1169,8 @@ void perf_event_task_migrate(struct task_struct *task, int new_cpu)
  * accessing the event control ...
From: Peter Zijlstra
Date: Tuesday, May 4, 2010 - 10:11 am

The alternative is dropping rq from the trace events, its not like
anybody outside sched.o can do anything sensible with it anyway.

--

From: Tejun Heo
Date: Tuesday, May 4, 2010 - 10:22 am

Hello,


The comment in include/trace/events/sched.h says...

 * (NOTE: the 'rq' argument is not used by generic trace events,
 *        but used by the latency tracer plugin. )

So, I left it there.  It would be great if all those @rq params can be
removed tho.  The latency tracer thing needs it, right?

Thanks.

-- 
tejun
--

From: Peter Zijlstra
Date: Tuesday, May 4, 2010 - 10:42 am

I had a quick look but couldn't actually find anything.

--

From: Steven Rostedt
Date: Tuesday, May 4, 2010 - 11:22 am

I believe the rq was used by the original latency tracer code that was
in the -rt patch set before ftrace. It is most likely there for
historical purposes. I guess it would be fine to just remove it.

-- Steve


--

From: Peter Zijlstra
Date: Tuesday, May 4, 2010 - 11:26 am

I'm building the below, so far so good... ;-)

---
 include/trace/events/sched.h      |   32 ++++++++++----------------------
 kernel/sched.c                    |    8 ++++----
 kernel/trace/trace_sched_wakeup.c |    5 ++---
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b..4f733ec 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -51,15 +51,12 @@ TRACE_EVENT(sched_kthread_stop_ret,
 
 /*
  * Tracepoint for waiting on task to unschedule:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- *        but used by the latency tracer plugin. )
  */
 TRACE_EVENT(sched_wait_task,
 
-	TP_PROTO(struct rq *rq, struct task_struct *p),
+	TP_PROTO(struct task_struct *p),
 
-	TP_ARGS(rq, p),
+	TP_ARGS(p),
 
 	TP_STRUCT__entry(
 		__array(	char,	comm,	TASK_COMM_LEN	)
@@ -79,15 +76,12 @@ TRACE_EVENT(sched_wait_task,
 
 /*
  * Tracepoint for waking up a task:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- *        but used by the latency tracer plugin. )
  */
 DECLARE_EVENT_CLASS(sched_wakeup_template,
 
-	TP_PROTO(struct rq *rq, struct task_struct *p, int success),
+	TP_PROTO(struct task_struct *p, int success),
 
-	TP_ARGS(rq, p, success),
+	TP_ARGS(p, success),
 
 	TP_STRUCT__entry(
 		__array(	char,	comm,	TASK_COMM_LEN	)
@@ -111,31 +105,25 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
 );
 
 DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
-	     TP_PROTO(struct rq *rq, struct task_struct *p, int success),
-	     TP_ARGS(rq, p, success));
+	     TP_PROTO(struct task_struct *p, int success),
+	     TP_ARGS(p, success));
 
 /*
  * Tracepoint for waking up a new task:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- *        but used by the latency tracer plugin. )
  */
 DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
-	     TP_PROTO(struct rq *rq, struct task_struct ...
From: Steven Rostedt
Date: Tuesday, May 4, 2010 - 11:32 am

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve


--

From: Tejun Heo
Date: Tuesday, May 4, 2010 - 9:48 pm

Cool, then I can remove SCHED_EVENT_RQ() thing then.

Thanks.

-- 
tejun
--

From: Tejun Heo
Date: Wednesday, May 5, 2010 - 2:58 am

Peter, can I include this patch into my series?  If so, can you please
post a patch w/ description?

Thanks.

-- 
tejun
--

From: tip-bot for Peter Zijlstra
Date: Friday, May 7, 2010 - 11:41 am

Commit-ID:  27a9da6538ee18046d7bff8e36a9f783542c54c3
Gitweb:     http://git.kernel.org/tip/27a9da6538ee18046d7bff8e36a9f783542c54c3
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 4 May 2010 20:36:56 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 May 2010 11:28:17 +0200

sched: Remove rq argument to the tracepoints

struct rq isn't visible outside of sched.o so its near useless to
expose the pointer, also there are no users of it, so remove it.

Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1272997616.1642.207.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/trace/events/sched.h      |   32 ++++++++++----------------------
 kernel/sched.c                    |    8 ++++----
 kernel/trace/ftrace.c             |    3 +--
 kernel/trace/trace_sched_switch.c |    5 ++---
 kernel/trace/trace_sched_wakeup.c |    5 ++---
 5 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b..4f733ec 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -51,15 +51,12 @@ TRACE_EVENT(sched_kthread_stop_ret,
 
 /*
  * Tracepoint for waiting on task to unschedule:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- *        but used by the latency tracer plugin. )
  */
 TRACE_EVENT(sched_wait_task,
 
-	TP_PROTO(struct rq *rq, struct task_struct *p),
+	TP_PROTO(struct task_struct *p),
 
-	TP_ARGS(rq, p),
+	TP_ARGS(p),
 
 	TP_STRUCT__entry(
 		__array(	char,	comm,	TASK_COMM_LEN	)
@@ -79,15 +76,12 @@ TRACE_EVENT(sched_wait_task,
 
 /*
  * Tracepoint for waking up a task:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- *        but used by the latency tracer plugin. )
  */
 DECLARE_EVENT_CLASS(sched_wakeup_template,
 
-	TP_PROTO(struct rq *rq, struct task_struct *p, int success),
+	TP_PROTO(struct ...
Previous thread: [PATCH 02/12] sched: rename preempt_notifiers to sched_notifiers and refactor implementation by Tejun Heo on Tuesday, May 4, 2010 - 5:38 am. (1 message)

Next thread: [PATCH 03/12] perf: add perf_event_task_migrate() by Tejun Heo on Tuesday, May 4, 2010 - 5:38 am. (7 messages)