From: Tejun Heo <tj@kernel.org>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: josef@toxicpanda.com, axboe@kernel.dk, yukuai3@huawei.com,
mkoutny@suse.com, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH -next v2 2/4] blk-throttle: fix wrong comparation while 'carryover_ios/bytes' is negative
Date: Tue, 29 Aug 2023 12:18:44 -1000 [thread overview]
Message-ID: <ZO5uxJSlHRxexZwk@slm.duckdns.org> (raw)
In-Reply-To: <20230816012708.1193747-3-yukuai1@huaweicloud.com>
On Wed, Aug 16, 2023 at 09:27:06AM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> carryover_ios/bytes[] can be negative in the case that ios are
> dispatched in the slice in advance, and then configuration is updated.
> For example:
>
> 1) set iops limit to 1000, and slice start is 0, slice end is 100ms;
> 2) current time is 0, and 100 ios are dispatched, those ios will not be
> throttled, hence io_disp is 100;
> 3) still at current time 0, update iops limit to 100, then carryover_ios
> is (0 - 100) = -100;
> 4) then, dispatch a new io at time 0, the expected result is that this
> io will wait for 1s. The calculation in tg_within_iops_limit:
>
> io_disp = 0;
> io_allowed = calculate_io_allowed + carryover_ios
> = 10 + (-100) = -90;
> io won't be throttled if (io_disp + 1 < io_allowed) passed.
>
> Before this patch, in step 4) (io_disp + 1 < io_allowed) is passed,
> because -90 for unsigned value is very huge, and such io won't be
> throttled.
>
> Fix this problem by checking if 'io/bytes_allowed' is negative first.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Thanks.
--
tejun
next prev parent reply other threads:[~2023-08-29 22:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 1:27 [PATCH -next v2 0/4] cleanup and fixes for 'carryover_ios/bytes' Yu Kuai
2023-08-16 1:27 ` [PATCH -next v2 1/4] blk-throttle: print signed value 'carryover_bytes/ios' for user Yu Kuai
2023-08-29 22:17 ` Tejun Heo
2023-08-16 1:27 ` [PATCH -next v2 2/4] blk-throttle: fix wrong comparation while 'carryover_ios/bytes' is negative Yu Kuai
2023-08-29 22:18 ` Tejun Heo [this message]
2023-08-16 1:27 ` [PATCH -next v2 3/4] blk-throttle: use calculate_io/bytes_allowed() for throtl_trim_slice() Yu Kuai
2023-08-29 22:20 ` Tejun Heo
2023-08-16 1:27 ` [PATCH -next v2 4/4] blk-throttle: consider 'carryover_ios/bytes' in throtl_trim_slice() Yu Kuai
2023-08-29 22:20 ` Tejun Heo
2023-08-30 16:15 ` [PATCH -next v2 0/4] cleanup and fixes for 'carryover_ios/bytes' Jens Axboe
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=ZO5uxJSlHRxexZwk@slm.duckdns.org \
--to=tj@kernel.org \
--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=mkoutny@suse.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.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®