From: Yu Kuai <yukuai1@huaweicloud.com>
To: Ming Lei <ming.lei@redhat.com>, Yu Kuai <yukuai1@huaweicloud.com>
Cc: tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk,
cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
yangerkun@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH 2/2] blk-throttle: fix off-by-one jiffies wait_time
Date: Tue, 25 Feb 2025 11:12:24 +0800 [thread overview]
Message-ID: <084e25a1-5ed7-3097-5bae-b87addeaf01f@huaweicloud.com> (raw)
In-Reply-To: <Z70qvZEBdq6L3-Yb@fedora>
Hi, Ming!
在 2025/02/25 10:28, Ming Lei 写道:
> Can you explain in details why it signals that the rate is expected now?
>
> If rate isn't expected, it will cause trouble to trim, even just the
> previous part.
Ok, for example, assume bps_limit is 1000bytes, 1 jiffes is 10ms, and
slice is 20ms(2 jiffies).
expected rate is 1000 / 1000 * 20 = 20 bytes per slice.
If user issue two 21 bytes IO, then wait time will be 30ms:
bytes_allowed = 20, extra_bytes = 1;
jiffy_wait = 1 + 2 = 3 jiffies
and consider
extra 1 jiffies by timer, throtl_trim_slice() will be called at:
jiffies = 40ms
slice_start = 0ms, slice_end= 40ms
bytes_disp = 21
In this case, before the patch, real rate in the first two slice is is
10.5 bytes per slice, and slice will be updated:
jiffies = 40ms
slice_start = 40ms, slice_end = 60ms,
bytes_disp = 0;
Hence the second IO will have to wait another 30ms;
With the patch, the real rate in the first slice is 20 bytes per slice,
which is the same as expected, and slice will be updated:
jiffies=40ms,
slice_start = 20ms, slice_end = 60ms,
bytes_disp = 1;
And now, the second IO will only have to wait 10ms;
Thanks,
Kuai
next prev parent reply other threads:[~2025-02-25 3:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-22 9:28 [PATCH 0/2] " Yu Kuai
2025-02-22 9:28 ` [PATCH 1/2] blk-throttle: cleanup throtl_extend_slice() Yu Kuai
2025-02-25 20:30 ` Tejun Heo
2025-02-22 9:28 ` [PATCH 2/2] blk-throttle: fix off-by-one jiffies wait_time Yu Kuai
2025-02-22 12:16 ` Ming Lei
2025-02-24 2:39 ` Yu Kuai
2025-02-24 3:28 ` Ming Lei
2025-02-24 7:03 ` Yu Kuai
2025-02-24 8:56 ` Ming Lei
2025-02-24 12:03 ` Yu Kuai
2025-02-25 1:24 ` Ming Lei
2025-02-25 2:07 ` Yu Kuai
2025-02-25 2:28 ` Ming Lei
2025-02-25 3:12 ` Yu Kuai [this message]
2025-02-25 8:21 ` Ming Lei
2025-02-25 11:09 ` Yu Kuai
2025-02-25 12:00 ` Ming Lei
2025-02-25 10:51 ` [PATCH 0/2] " Michal Koutný
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=084e25a1-5ed7-3097-5bae-b87addeaf01f@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=tj@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.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
all inboxes | Powered by JetHome®