From: Ingo Molnar <mingo@elte.hu>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@zip.com.au>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [02/19] sched: add latency tracer callbacks to the scheduler
Date: Sun, 10 Feb 2008 08:20:00 +0100 [thread overview]
Message-ID: <20080210071959.GC4100@elte.hu> (raw)
From: Ingo Molnar <mingo@elte.hu>
add 3 lightweight callbacks to the tracer backend.
zero impact if tracing is turned off.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
include/linux/sched.h | 26 ++++++++++++++++++++++++++
kernel/sched.c | 3 +++
2 files changed, 29 insertions(+)
Index: linux/include/linux/sched.h
===================================================================
--- linux.orig/include/linux/sched.h
+++ linux/include/linux/sched.h
@@ -2027,6 +2027,32 @@ extern int sched_mc_power_savings, sched
extern void normalize_rt_tasks(void);
+#ifdef CONFIG_CONTEXT_SWITCH_TRACER
+extern void
+ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next);
+#else
+static inline void
+ftrace_ctx_switch(struct task_struct *prev, struct task_struct *next)
+{
+}
+#endif
+
+#ifdef CONFIG_SCHED_TRACER
+extern void
+ftrace_wake_up_task(struct task_struct *wakee, struct task_struct *curr);
+extern void
+ftrace_wake_up_new_task(struct task_struct *wakee, struct task_struct *curr);
+#else
+static inline void
+ftrace_wake_up_task(struct task_struct *wakee, struct task_struct *curr)
+{
+}
+static inline void
+ftrace_wake_up_new_task(struct task_struct *wakee, struct task_struct *curr)
+{
+}
+#endif
+
#ifdef CONFIG_FAIR_GROUP_SCHED
extern struct task_group init_task_group;
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -1867,6 +1867,7 @@ static int try_to_wake_up(struct task_st
out_activate:
#endif /* CONFIG_SMP */
+ ftrace_wake_up_task(p, rq->curr);
schedstat_inc(p, se.nr_wakeups);
if (sync)
schedstat_inc(p, se.nr_wakeups_sync);
@@ -2007,6 +2008,7 @@ void wake_up_new_task(struct task_struct
p->sched_class->task_new(rq, p);
inc_nr_running(rq);
}
+ ftrace_wake_up_new_task(p, rq->curr);
check_preempt_curr(rq, p);
#ifdef CONFIG_SMP
if (p->sched_class->task_wake_up)
@@ -2179,6 +2181,7 @@ context_switch(struct rq *rq, struct tas
struct mm_struct *mm, *oldmm;
prepare_task_switch(rq, prev, next);
+ ftrace_ctx_switch(prev, next);
mm = next->mm;
oldmm = prev->active_mm;
/*
reply other threads:[~2008-02-10 7:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080210071959.GC4100@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox