From: Wen Yang <wenyang@linux.alibaba.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>,
xlpang@linux.alibaba.com, Mikulas Patocka <mpatocka@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] block: make the io_ticks counter more accurate
Date: Fri, 27 Dec 2019 00:42:16 +0800 [thread overview]
Message-ID: <533328c7-4158-d9fd-d8db-0d02eb9c5108@linux.alibaba.com> (raw)
In-Reply-To: <41175786-8a02-62e0-fc79-955ec0e74aeb@kernel.dk>
On 2019/12/26 11:39 上午, Jens Axboe wrote:
> On 12/25/19 8:10 PM, Wen Yang wrote:
>> Instead of the jiffies, we should update the io_ticks counter
>> with the passed in parameter 'now'.
>
> I'm still missing some justification for this. What exactly is this
> patch trying to solve or improve? Your commit message says "we should",
> but why?
>
Hi Jens,
Thank you for your comments.
We observed in the document that:
io_ticks
========
This value counts the number of milliseconds during which the device has
had I/O requests queued.
And the iostat command uses io_ticks count to calculate %util:
https://github.com/sysstat/sysstat/blob/master/rd_stats.c#L372
eg:
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s
avgrq-sz avgqu-sz await r_await w_await svctm %util
So we need to unify the time windows of these statistics(io_ticks,
rd_tick, time_in_queue, etc).
However, the current code uses jiffies to count io_ticks.
Jiffies is different from the passed in parameter 'now',
so these statistics will be inconsistent:
void blk_account_io_done(struct request *req, u64 now)
{
…
update_io_ticks(part, jiffies);
part_stat_inc(part, ios[sgrp]);
part_stat_add(part, nsecs[sgrp], now - req->start_time_ns);
part_stat_add(part, time_in_queue, nsecs_to_jiffies64(now -
req->start_time_ns));
…
}
In addition, we also found another issue:
the update_io_tick() function only adds one to io_ticks at a time,
which will result in the calculated %util lower than the real one.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/block/bio.c#n1713
We will try our best to improve it.
please kindly help with some suggestions.
Thanks.
--
Best Regards,
Wen
prev parent reply other threads:[~2019-12-26 16:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-26 3:10 [PATCH v2] block: make the io_ticks counter more accurate Wen Yang
2019-12-26 3:39 ` Jens Axboe
2019-12-26 16:42 ` Wen Yang [this message]
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=533328c7-4158-d9fd-d8db-0d02eb9c5108@linux.alibaba.com \
--to=wenyang@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@redhat.com \
--cc=xlpang@linux.alibaba.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).