From: Yafang Shao <laoar.shao@gmail.com>
To: peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, shaoyafang@didiglobal.com,
Yafang Shao <laoar.shao@gmail.com>
Subject: [PATCH v2] sched: fair: fix missed CONFIG_SCHEDSTATS
Date: Thu, 7 Mar 2019 19:20:11 +0800 [thread overview]
Message-ID: <1551957611-31457-1-git-send-email-laoar.shao@gmail.com> (raw)
When I'm using trace_sched_stat_{iowait, blocked, wait, sleep} to
measure how long the processes are stalled, there's always no output
from
trace_pipe while there're really some tasks in uninterruptible sleep
state. That makes me confused, so I try to investigate why.
Finally I find the reason is that CONFIG_SCHEDSTATS is not set.
To avoid such kind of confusion, we should not expose these tracepoints
if CONFIG_SCHEDSTATS is not set.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
include/trace/events/sched.h | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 9a4bdfa..f060940 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -241,7 +241,6 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
DEFINE_EVENT(sched_process_template, sched_process_free,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));
-
/*
* Tracepoint for a task exiting:
@@ -336,6 +335,7 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
__entry->pid, __entry->old_pid)
);
+#ifdef CONFIG_SCHEDSTATS
/*
* XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
* adding sched_stat support to SCHED_FIFO/RR would be welcome.
@@ -395,6 +395,28 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
TP_PROTO(struct task_struct *tsk, u64 delay),
TP_ARGS(tsk, delay));
+#else
+
+#ifndef DEFINE_EVENT_NONE
+#define DEFINE_EVENT_NONE(name, var) \
+ static inline void trace_##name(var) \
+ { \
+ }
+
+DEFINE_EVENT_NONE(sched_stat_wait,
+ TP_PROTO(struct task_struct *tsk, u64 delay))
+
+DEFINE_EVENT_NONE(sched_stat_sleep,
+ TP_PROTO(struct task_struct *tsk, u64 delay))
+
+DEFINE_EVENT_NONE(sched_stat_iowait,
+ TP_PROTO(struct task_struct *tsk, u64 delay))
+
+DEFINE_EVENT_NONE(sched_stat_blocked,
+ TP_PROTO(struct task_struct *tsk, u64 delay))
+#endif
+#endif
+
/*
* Tracepoint for accounting runtime (time the task is executing
* on a CPU).
--
1.8.3.1
reply other threads:[~2019-03-07 11:20 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=1551957611-31457-1-git-send-email-laoar.shao@gmail.com \
--to=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=shaoyafang@didiglobal.com \
/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
all inboxes | Powered by JetHome®