diff options
| author | Yafang Shao <laoar.shao@gmail.com> | 2019-03-26 08:13:10 -0400 |
|---|---|---|
| committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2019-04-08 09:22:51 -0400 |
| commit | 2a09b5de235a6b5f76193a2ed46546a2944f98bf (patch) | |
| tree | c3bc26ac15fd9734661db114a895d85d72fb58e2 | |
| parent | 163363455b42a1cf833742177149d1352dfe673e (diff) | |
sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set
The tracepoints trace_sched_stat_{iowait, blocked, wait, sleep} should
be not exposed to user if CONFIG_SCHEDSTATS is not set.
Link: http://lkml.kernel.org/r/1553602391-11926-3-git-send-email-laoar.shao@gmail.com
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
| -rw-r--r-- | include/trace/events/sched.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 9a4bdfadab07..c8c7c7efb487 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -241,7 +241,6 @@ DECLARE_EVENT_CLASS(sched_process_template, | |||
| 241 | DEFINE_EVENT(sched_process_template, sched_process_free, | 241 | DEFINE_EVENT(sched_process_template, sched_process_free, |
| 242 | TP_PROTO(struct task_struct *p), | 242 | TP_PROTO(struct task_struct *p), |
| 243 | TP_ARGS(p)); | 243 | TP_ARGS(p)); |
| 244 | |||
| 245 | 244 | ||
| 246 | /* | 245 | /* |
| 247 | * Tracepoint for a task exiting: | 246 | * Tracepoint for a task exiting: |
| @@ -336,11 +335,20 @@ TRACE_EVENT(sched_process_exec, | |||
| 336 | __entry->pid, __entry->old_pid) | 335 | __entry->pid, __entry->old_pid) |
| 337 | ); | 336 | ); |
| 338 | 337 | ||
| 338 | |||
| 339 | #ifdef CONFIG_SCHEDSTATS | ||
| 340 | #define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT | ||
| 341 | #define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS | ||
| 342 | #else | ||
| 343 | #define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT_NOP | ||
| 344 | #define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS_NOP | ||
| 345 | #endif | ||
| 346 | |||
| 339 | /* | 347 | /* |
| 340 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE | 348 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE |
| 341 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. | 349 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. |
| 342 | */ | 350 | */ |
| 343 | DECLARE_EVENT_CLASS(sched_stat_template, | 351 | DECLARE_EVENT_CLASS_SCHEDSTAT(sched_stat_template, |
| 344 | 352 | ||
| 345 | TP_PROTO(struct task_struct *tsk, u64 delay), | 353 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 346 | 354 | ||
| @@ -363,12 +371,11 @@ DECLARE_EVENT_CLASS(sched_stat_template, | |||
| 363 | (unsigned long long)__entry->delay) | 371 | (unsigned long long)__entry->delay) |
| 364 | ); | 372 | ); |
| 365 | 373 | ||
| 366 | |||
| 367 | /* | 374 | /* |
| 368 | * Tracepoint for accounting wait time (time the task is runnable | 375 | * Tracepoint for accounting wait time (time the task is runnable |
| 369 | * but not actually running due to scheduler contention). | 376 | * but not actually running due to scheduler contention). |
| 370 | */ | 377 | */ |
| 371 | DEFINE_EVENT(sched_stat_template, sched_stat_wait, | 378 | DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_wait, |
| 372 | TP_PROTO(struct task_struct *tsk, u64 delay), | 379 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 373 | TP_ARGS(tsk, delay)); | 380 | TP_ARGS(tsk, delay)); |
| 374 | 381 | ||
| @@ -376,7 +383,7 @@ DEFINE_EVENT(sched_stat_template, sched_stat_wait, | |||
| 376 | * Tracepoint for accounting sleep time (time the task is not runnable, | 383 | * Tracepoint for accounting sleep time (time the task is not runnable, |
| 377 | * including iowait, see below). | 384 | * including iowait, see below). |
| 378 | */ | 385 | */ |
| 379 | DEFINE_EVENT(sched_stat_template, sched_stat_sleep, | 386 | DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_sleep, |
| 380 | TP_PROTO(struct task_struct *tsk, u64 delay), | 387 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 381 | TP_ARGS(tsk, delay)); | 388 | TP_ARGS(tsk, delay)); |
| 382 | 389 | ||
| @@ -384,14 +391,14 @@ DEFINE_EVENT(sched_stat_template, sched_stat_sleep, | |||
| 384 | * Tracepoint for accounting iowait time (time the task is not runnable | 391 | * Tracepoint for accounting iowait time (time the task is not runnable |
| 385 | * due to waiting on IO to complete). | 392 | * due to waiting on IO to complete). |
| 386 | */ | 393 | */ |
| 387 | DEFINE_EVENT(sched_stat_template, sched_stat_iowait, | 394 | DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_iowait, |
| 388 | TP_PROTO(struct task_struct *tsk, u64 delay), | 395 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 389 | TP_ARGS(tsk, delay)); | 396 | TP_ARGS(tsk, delay)); |
| 390 | 397 | ||
| 391 | /* | 398 | /* |
| 392 | * Tracepoint for accounting blocked time (time the task is in uninterruptible). | 399 | * Tracepoint for accounting blocked time (time the task is in uninterruptible). |
| 393 | */ | 400 | */ |
| 394 | DEFINE_EVENT(sched_stat_template, sched_stat_blocked, | 401 | DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_blocked, |
| 395 | TP_PROTO(struct task_struct *tsk, u64 delay), | 402 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 396 | TP_ARGS(tsk, delay)); | 403 | TP_ARGS(tsk, delay)); |
| 397 | 404 | ||
