From: Peter Zijlstra <peterz@infradead.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
shaoyafang@didiglobal.com
Subject: Re: [PATCH] sched: fair: fix missed CONFIG_SCHEDSTATS
Date: Wed, 6 Mar 2019 11:09:07 +0100 [thread overview]
Message-ID: <20190306100907.GT32477@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1551861826-12592-1-git-send-email-laoar.shao@gmail.com>
On Wed, Mar 06, 2019 at 04:43:46PM +0800, Yafang Shao wrote:
> When I'm using trace_sched_stat_{iowait, blocked, wait, sleep} to
> measure how long the processes are stalled, there's always no output from
> trace_pipe while there're really some tasks in uninterruptible sleep
> state. That makes me confused, so I try to investigate why.
> Finally I find the reason is that CONFIG_SCHEDSTATS is not set.
>
> To avoid such kind of confusion, we should not expose these tracepoints
> if CONFIG_SCHEDSTATS is not set.
Yeah, lets not sprinkle #ifdef. Big fat NAK.
Also, the below seem to indicate your compiler is stupid. Without
CONFIG_SCHEDSTAT, schedstat_enabled() should be a constant 0 and DCE
should delete all code.
> @@ -976,6 +982,7 @@ static void update_curr_fair(struct rq *rq)
> static inline void
> update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
> {
> +#ifdef CONFIG_SCHEDSTATS
> if (!schedstat_enabled())
> return;
>
> @@ -988,12 +995,13 @@ static void update_curr_fair(struct rq *rq)
>
> if (flags & ENQUEUE_WAKEUP)
> update_stats_enqueue_sleeper(cfs_rq, se);
> +#endif
> }
>
> static inline void
> update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
> {
> -
> +#ifdef CONFIG_SCHEDSTATS
> if (!schedstat_enabled())
> return;
>
> @@ -1014,6 +1022,7 @@ static void update_curr_fair(struct rq *rq)
> __schedstat_set(se->statistics.block_start,
> rq_clock(rq_of(cfs_rq)));
> }
> +#endif
> }
>
> /*
> @@ -4090,6 +4099,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
> update_stats_curr_start(cfs_rq, se);
> cfs_rq->curr = se;
>
> +#ifdef CONFIG_SCHEDSTATS
> /*
> * Track our maximum slice length, if the CPU's load is at
> * least twice that of our own weight (i.e. dont track it
> @@ -4100,6 +4110,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
> max((u64)schedstat_val(se->statistics.slice_max),
> se->sum_exec_runtime - se->prev_sum_exec_runtime));
> }
> +#endif
>
> se->prev_sum_exec_runtime = se->sum_exec_runtime;
> }
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2019-03-06 10:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 8:43 [PATCH] sched: fair: fix missed CONFIG_SCHEDSTATS Yafang Shao
2019-03-06 10:09 ` Peter Zijlstra [this message]
2019-03-06 10:15 ` Yafang Shao
2019-03-06 11:27 ` Peter Zijlstra
2019-03-06 11:49 ` Yafang Shao
2019-03-06 12:38 ` Peter Zijlstra
2019-03-06 12:53 ` Yafang Shao
2019-03-07 7:49 ` Yafang Shao
2019-03-07 9:55 ` Peter Zijlstra
2019-03-07 10:41 ` Yafang Shao
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=20190306100907.GT32477@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=shaoyafang@didiglobal.com \
/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