linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	mpatocka@redhat.com,
	Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Subject: Re: very inaccurate %util of iostat
Date: Mon, 23 Mar 2020 23:53:14 -0400	[thread overview]
Message-ID: <20200324035313.GE30700@redhat.com> (raw)
In-Reply-To: <20200324031942.GA3060@ming.t460p>

On Mon, Mar 23 2020 at 11:19pm -0400,
Ming Lei <ming.lei@redhat.com> wrote:

> Hi Guys,
> 
> Commit 5b18b5a73760 ("block: delete part_round_stats and switch to less precise counting")
> changes calculation of 'io_ticks' a lot.
> 
> In theory, io_ticks counts the time when there is any IO in-flight or in-queue,
> so it has to rely on in-flight counting of IO.
> 
> However, commit 5b18b5a73760 changes io_ticks's accounting into the
> following way:
> 
> 	stamp = READ_ONCE(part->stamp);
> 	if (unlikely(stamp != now)) {
> 		if (likely(cmpxchg(&part->stamp, stamp, now) == stamp))
> 			__part_stat_add(part, io_ticks, 1);
> 	}
> 
> So this way doesn't use any in-flight IO's info, simply adding 1 if stamp
> changes compared with previous stamp, no matter if there is any in-flight
> IO or not.
> 
> Now when there is very heavy IO on disks, %util is still much less than
> 100%, especially on HDD, the reason could be that IO latency can be much more
> than 1ms in case of 1000HZ, so the above calculation is very inaccurate.
> 
> Another extreme example is that if IOs take long time to complete, such
> as IO stall, %util may show 0% utilization, instead of 100%.

Hi Ming,

Your email triggered a memory of someone else (Konstantin Khlebnikov)
having reported and fixed this relatively recently, please see this
patchset: https://lkml.org/lkml/2020/3/2/336

Obviously this needs fixing.  If you have time to review/polish the
proposed patches that'd be great.

Mike


  reply	other threads:[~2020-03-24  3:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  3:19 [regression] very inaccurate %util of iostat Ming Lei
2020-03-24  3:53 ` Mike Snitzer [this message]
2020-10-23  2:48   ` Weiping Zhang
2020-10-23  5:50     ` Weiping Zhang
     [not found]       ` <156351603710306@mail.yandex-team.ru>
2020-10-27  4:26         ` Weiping Zhang

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=20200324035313.GE30700@redhat.com \
    --to=snitzer@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=mpatocka@redhat.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).