[PATCH 2/3] sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set
From: Yafang Shao
Date: Mon Mar 25 2019 - 21:40:40 EST
The tracepoints trace_sched_stat_{iowait, blocked, wait, sleep} should
be not exposed to user if CONFIG_SCHEDSTATS is not set.
Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
---
include/trace/events/sched.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 9a4bdfa..4686c7f 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -336,6 +336,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 +396,19 @@ 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 /* CONFIG_SCHEDSTATS */
+
+TRACE_EVENT_NONE(sched_stat_wait,
+ TP_PROTO(struct task_struct *tsk, u64 delay));
+TRACE_EVENT_NONE(sched_stat_sleep,
+ TP_PROTO(struct task_struct *tsk, u64 delay));
+TRACE_EVENT_NONE(sched_stat_iowait,
+ TP_PROTO(struct task_struct *tsk, u64 delay));
+TRACE_EVENT_NONE(sched_stat_blocked,
+ TP_PROTO(struct task_struct *tsk, u64 delay));
+
+#endif /* CONFIG_SCHEDSTATS */
+
/*
* Tracepoint for accounting runtime (time the task is executing
* on a CPU).
--
1.8.3.1