Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4213110img; Tue, 26 Mar 2019 05:22:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPlc+1zqzPKhA14fM25e03k+O7/9faJ4i/kS224EdyjEnJMeVo1NaUSRxfjg3fgc8op9ox X-Received: by 2002:a17:902:56a:: with SMTP id 97mr30595484plf.320.1553602978117; Tue, 26 Mar 2019 05:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553602978; cv=none; d=google.com; s=arc-20160816; b=wMsDYzNm6odF2xkZz0l+U0Sz+tFD7iCu+pgwEpN9jNSjXhRFIDAAXiVsoiCMHW/hpF Zf8y2ZCdDoyFDLzeNTvtNvymVZx4OiX2qP62tzGXzbRh1Xl2oJiEhXJh9iSA24kUAwEZ n+xbKggGoFebwiPt3/re+vFZ5rDKneypE4ditbF8T9d+Fsw8kwV8RezNdOPO7NOD+d2C GP9AJlCNHCclEN/FI+Rc07kM97vfhvHCYcxY3lGzAa0JXMw1tWL8uqjxr7GSlzfAL1oP mAQUaqRLXcka+XW6K3moiuuSyEKwULSs42uR0ZGqUEG6DLQzF33ccqcv1jX3wejIODuc EdXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=zom01GuwbvbIltUfTBaFkEywwCDmwNdUnxd42mDr7mA=; b=I2m25sHtZLeJBgqipwJblGa5kE8dM2UHrGn5OAQpizOFlN+Sgv9DOGbuJ5knobL8lC iwrmKBpwRwoB94MpdPiKo3hjs54A9/yROs6PPxVAofFDAKqUGoQ1z46XAiHThqK2C+zj Tovo2Mf3oxf15gBQf2GW22kyQZ71g2VU8Sp3KtVjL19D7TlpXI5P90pQShEGZ0neqrtf Z6o9FL5TDtOqYqMm/7EkmmRomGcaBLmCvrClQ4tRhL0pbFEvBoaxQxtgx/fIHVWDKRT2 TY5ZldLpcKinIt43nqiNQXwR6F1vldbQqoxfYBNaiOwVHlFFQdAKFLLSC9nK3UHpGcGs 1HFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si10041006pgd.455.2019.03.26.05.22.42; Tue, 26 Mar 2019 05:22:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730722AbfCZMWB (ORCPT + 99 others); Tue, 26 Mar 2019 08:22:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:49098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbfCZMWB (ORCPT ); Tue, 26 Mar 2019 08:22:01 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DC502075C; Tue, 26 Mar 2019 12:21:59 +0000 (UTC) Date: Tue, 26 Mar 2019 08:21:57 -0400 From: Steven Rostedt To: Yafang Shao Cc: mingo@redhat.com, peterz@infradead.org, paulmck@linux.ibm.com, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, shaoyafang@didiglobal.com Subject: Re: [PATCH v2 2/3] sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set Message-ID: <20190326082157.1d0c01cb@gandalf.local.home> In-Reply-To: <1553602391-11926-3-git-send-email-laoar.shao@gmail.com> References: <1553602391-11926-1-git-send-email-laoar.shao@gmail.com> <1553602391-11926-3-git-send-email-laoar.shao@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter, Ingo, Are you OK with this patch? If you ack it, I'll pull it in through my tree. -- Steve On Tue, 26 Mar 2019 20:13:10 +0800 Yafang Shao wrote: > 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 > --- > 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 9a4bdfa..c8c7c7e 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,11 +335,20 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct * > __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 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct * > (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 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct * > * 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 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct * > * 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)); >