From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mel Gorman <mgorman@suse.de>, LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Matt Fleming <matt@codeblueprint.co.uk>
Subject: Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled
Date: Thu, 13 Apr 2017 04:05:48 -0700 [thread overview]
Message-ID: <20170413110548.GL6820@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170412160432.481ee5fb@gandalf.local.home>
> +#if defined(CONFIG_TRACING) && defined(CONFIG_SCHEDSTATS)
> +int schedstat_tracepoint_reg(void);
> +void schedstat_tracepoint_unreg(void);
> +#else
> +static inline int schedstat_tracepoint_reg(void) { return 0; }
> +static inline void schedstat_tracepoint_unreg(void) { }
> +#endif
> +
>
> +#ifdef CONFIG_TRACING
Shouldn't this be also
> +#if defined(CONFIG_TRACING) && defined(CONFIG_SCHEDSTATS) ????
If CONFIG_TRACING is defined but CONFIG_SCHEDSTATS is not then build
should complain about duplicate schedstat_tracepoint_reg(). No?
> +static int schedstat_tracepoint_ref;
> +static bool schedstat_save_state;
> +/*
> + * schedstat_tracepoint_reg() and unreg() are called by the tracepoint
> + * regfunc/unregfunc functions. They are protected by the tracepoint mutex.
> + * See kernel/tracepoint.c:tracepoint_add_func().
> + *
> + * The modifications to schedstat_tracepoint_ref and schedstat_save_state
> + * are only done under that mutex, and do not need further protection.
> + */
> +int schedstat_tracepoint_reg(void)
> +{
> + if (!schedstat_tracepoint_ref) {
> + schedstat_save_state = schedstat_enabled();
> + if (!schedstat_save_state)
> + set_schedstats(true);
> + }
> + schedstat_tracepoint_ref++;
> + return 0;
> +}
> +
> +void schedstat_tracepoint_unreg(void)
> +{
> + schedstat_tracepoint_ref--;
> + if (schedstat_tracepoint_ref || schedstat_save_state)
> + return;
> + set_schedstats(false);
> +}
> +#endif
next prev parent reply other threads:[~2017-04-13 11:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-12 20:04 [PATCH] sched: Enabled schedstat when schedstat tracepoints are enabled Steven Rostedt
2017-04-13 2:02 ` kbuild test robot
2017-04-13 9:00 ` [PATCH v2] " Peter Zijlstra
2017-04-13 9:01 ` Peter Zijlstra
2017-04-13 14:08 ` Steven Rostedt
2017-04-13 10:01 ` Mel Gorman
2017-04-13 14:12 ` Steven Rostedt
2017-04-13 11:05 ` Srikar Dronamraju [this message]
2017-04-13 14:14 ` 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=20170413110548.GL6820@linux.vnet.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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