All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sched: fair: fix missed CONFIG_SCHEDSTATS
@ 2019-03-07 11:20 Yafang Shao
  0 siblings, 0 replies; only message in thread
From: Yafang Shao @ 2019-03-07 11:20 UTC (permalink / raw)
  To: peterz; +Cc: linux-kernel, shaoyafang, Yafang Shao

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-07 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 11:20 [PATCH v2] sched: fair: fix missed CONFIG_SCHEDSTATS Yafang Shao

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.