linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Tom Hromatka <tom.hromatka@oracle.com>,
	tom.hromatka@oracle.com, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, fweisbec@gmail.com,
	mingo@kernel.org, adobriyan@gmail.com
Subject: Re: [RESEND PATCH 1/2] tick-sched: Do not clear the iowait and idle times
Date: Sun, 13 Sep 2020 23:27:14 +0200	[thread overview]
Message-ID: <87ft7lpdu5.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20200909144122.77210-2-tom.hromatka@oracle.com>

Tom,

On Wed, Sep 09 2020 at 08:41, Tom Hromatka wrote:
> A customer reported that when a cpu goes offline and then comes back
> online, the overall cpu idle and iowait data in /proc/stat decreases.
> This is wreaking havoc with their cpu usage calculations.

for a changelog it's pretty irrelevant whether a customer reported
something or not.

Fact is that this happens and you fail to explain WHY it happens,
i.e. because the values are cleared when the CPU goes down and therefore
the accounting starts over from 0 when the CPU comes online again.

Describing this is much more useful than showing random numbers before
and after.

> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -1375,13 +1375,22 @@ void tick_setup_sched_timer(void)
>  void tick_cancel_sched_timer(int cpu)
>  {
>  	struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
> +	ktime_t idle_sleeptime, iowait_sleeptime;
>  
>  # ifdef CONFIG_HIGH_RES_TIMERS
>  	if (ts->sched_timer.base)
>  		hrtimer_cancel(&ts->sched_timer);
>  # endif
>  
> +	/* save off and restore the idle_sleeptime and the iowait_sleeptime
> +	 * to avoid discontinuities and ensure that they are monotonically
> +	 * increasing
> +	 */

  /*
   * Please use sane multiline comment style and not the above
   * abomination.
   */

Also please explain what this 'monotonically increasing' thing is
about. Without consulting the changelog it's hard to figure out what
that means.

Comments are valuable but only when they make actually sense on
their own. Something like the below perhaps?

  /*
   * Preserve idle and iowait sleep times accross a CPU offline/online
   * sequence as they are accumulative.
   */
   
Hmm?

> +	idle_sleeptime = ts->idle_sleeptime;
> +	iowait_sleeptime = ts->iowait_sleeptime;
>  	memset(ts, 0, sizeof(*ts));
> +	ts->idle_sleeptime = idle_sleeptime;
> +	ts->iowait_sleeptime = iowait_sleeptime;
>  }

Thanks,

        tglx

  reply	other threads:[~2020-09-13 21:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 14:41 [RESEND PATCH 0/2] iowait and idle fixes in /proc/stat Tom Hromatka
2020-09-09 14:41 ` [RESEND PATCH 1/2] tick-sched: Do not clear the iowait and idle times Tom Hromatka
2020-09-13 21:27   ` Thomas Gleixner [this message]
2020-09-09 14:41 ` [RESEND PATCH 2/2] /proc/stat: Simplify iowait and idle calculations when cpu is offline Tom Hromatka
2020-09-10 12:14   ` Alexey Dobriyan
2020-09-13 21:35   ` Thomas Gleixner
2020-09-14 16:31 ` [RESEND PATCH 0/2] iowait and idle fixes in /proc/stat Tom Hromatka

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=87ft7lpdu5.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=adobriyan@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tom.hromatka@oracle.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;
as well as URLs for NNTP newsgroup(s).