Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1622922
| From | Srikar Dronamraju <srikar@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled |
| Date | 2017-04-13 13:10 +0200 |
| Message-ID | <tvKNs-289-1@gated-at.bofh.it> (permalink) |
| References | <tvwKu-Gu-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> +#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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] sched: Enabled schedstat when schedstat tracepoints are enabled Steven Rostedt <rostedt@goodmis.org> - 2017-04-12 22:10 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Peter Zijlstra <peterz@infradead.org> - 2017-04-13 11:10 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Peter Zijlstra <peterz@infradead.org> - 2017-04-13 11:10 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Steven Rostedt <rostedt@goodmis.org> - 2017-04-13 16:10 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Mel Gorman <mgorman@suse.de> - 2017-04-13 12:10 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Steven Rostedt <rostedt@goodmis.org> - 2017-04-13 16:20 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Srikar Dronamraju <srikar@linux.vnet.ibm.com> - 2017-04-13 13:10 +0200
Re: [PATCH v2] sched: Enabled schedstat when schedstat tracepoints are enabled Steven Rostedt <rostedt@goodmis.org> - 2017-04-13 16:20 +0200
csiph-web