linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Yafang Shao <laoar.shao@gmail.com>
Subject: [for-next][PATCH 18/19] sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set
Date: Wed, 03 Apr 2019 21:37:39 -0400	[thread overview]
Message-ID: <20190404013746.085272166@goodmis.org> (raw)
In-Reply-To: 20190404013721.023858792@goodmis.org

From: Yafang Shao <laoar.shao@gmail.com>

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>
---
 include/trace/events/sched.h | 21 ++++++++++++++-------
 1 file 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,
 DEFINE_EVENT(sched_process_template, sched_process_free,
 	     TP_PROTO(struct task_struct *p),
 	     TP_ARGS(p));
-	     
 
 /*
  * Tracepoint for a task exiting:
@@ -336,11 +335,20 @@ TRACE_EVENT(sched_process_exec,
 		  __entry->pid, __entry->old_pid)
 );
 
+
+#ifdef CONFIG_SCHEDSTATS
+#define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT
+#define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS
+#else
+#define DEFINE_EVENT_SCHEDSTAT DEFINE_EVENT_NOP
+#define DECLARE_EVENT_CLASS_SCHEDSTAT DECLARE_EVENT_CLASS_NOP
+#endif
+
 /*
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
-DECLARE_EVENT_CLASS(sched_stat_template,
+DECLARE_EVENT_CLASS_SCHEDSTAT(sched_stat_template,
 
 	TP_PROTO(struct task_struct *tsk, u64 delay),
 
@@ -363,12 +371,11 @@ DECLARE_EVENT_CLASS(sched_stat_template,
 			(unsigned long long)__entry->delay)
 );
 
-
 /*
  * Tracepoint for accounting wait time (time the task is runnable
  * but not actually running due to scheduler contention).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_wait,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_wait,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
@@ -376,7 +383,7 @@ DEFINE_EVENT(sched_stat_template, sched_stat_wait,
  * Tracepoint for accounting sleep time (time the task is not runnable,
  * including iowait, see below).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_sleep,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
@@ -384,14 +391,14 @@ DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
  * Tracepoint for accounting iowait time (time the task is not runnable
  * due to waiting on IO to complete).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_iowait,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
 /*
  * Tracepoint for accounting blocked time (time the task is in uninterruptible).
  */
-DEFINE_EVENT(sched_stat_template, sched_stat_blocked,
+DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_blocked,
 	     TP_PROTO(struct task_struct *tsk, u64 delay),
 	     TP_ARGS(tsk, delay));
 
-- 
2.20.1



  parent reply	other threads:[~2019-04-04  1:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04  1:37 [for-next][PATCH 00/19] tracing: Updates for 5.2 Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 01/19] ring-buffer: Fix ring buffer size in rb_write_something() Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 03/19] tracing: Add tracing error log Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 04/19] tracing: Save the last hist commands associated event name Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 05/19] tracing: Use tracing error_log with hist triggers Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 06/19] tracing: Use tracing error_log with trace event filters Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 07/19] tracing: Use tracing error_log with probe events Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 08/19] tracing: Add trace_array parameter to create_event_filter() Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 09/19] tracing: Have histogram code pass around trace_array for error handling Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 10/19] tracing: Have the error logs show up in the proper instances Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 11/19] selftests/ftrace: Add error_log testcase for probe errors Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 12/19] selftests/ftrace: Move kprobe/uprobe check_error() to test.d/functions Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 13/19] selftests/ftrace: Remove trigger-extended-error-support testcase Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 14/19] selftests/ftrace: Add tracing/error_log testcase Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 15/19] tracing: Add tracing/error_log Documentation Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 16/19] tracing: Add error_log to README Steven Rostedt
2019-04-04  1:37 ` [for-next][PATCH 17/19] tracing: introduce TRACE_EVENT_NOP() Steven Rostedt
2019-04-04  1:37 ` Steven Rostedt [this message]
2019-04-04  1:37 ` [for-next][PATCH 19/19] rcu: validate arguments for rcu tracepoints Steven Rostedt

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=20190404013746.085272166@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).