From: Kemeng Shi <shikemeng@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: <josef@toxicpanda.com>, <axboe@kernel.dk>,
<cgroups@vger.kernel.org>, <linux-block@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 04/11] blk-throttle: correct calculation of wait time in tg_may_dispatch
Date: Thu, 24 Nov 2022 20:10:03 +0800 [thread overview]
Message-ID: <fdf1aa87-b459-172a-f3f0-31afcb696c76@huawei.com> (raw)
In-Reply-To: <Y35kELlFkI/BtkqC@slm.duckdns.org>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
on 11/24/2022 2:18 AM, Tejun Heo wrote:
> On Wed, Nov 23, 2022 at 02:03:54PM +0800, Kemeng Shi wrote:
>> If bps and iops both reach limit, we always return bps wait time as
>> tg_within_iops_limit is after "tg_within_bps_limit(tg, bio, bps_limit) &&"
>> and will not be called if tg_within_bps_limit return true.
Here is a mistake, the right word should be:
tg_within_iops_limit is after "tg_within_bps_limit(tg, bio, bps_limit) &&"
and will not be called if tg_within_bps_limit return *false*.
> Maybe it's obvious but it'd be better to explain "why" this change is being
> made.
In C language, When executing "if (expression1 && expression2)" and
expression1 return false, the expression2 may not be executed.
For "tg_within_bps_limit(tg, bio, bps_limit, &bps_wait) &&
tg_within_iops_limit(tg, bio, iops_limit, &iops_wait))", if bps is
limited, tg_within_bps_limit will return false and
tg_within_iops_limit will not be called. So even bps and iops are
both limited, iops_wait will not be calculated and is zero here.
So wait time of bps is always returned.
>> @@ -939,8 +926,9 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio,
>> jiffies + tg->td->throtl_slice);
>> }
>>
>> - if (tg_within_bps_limit(tg, bio, bps_limit, &bps_wait) &&
>> - tg_within_iops_limit(tg, bio, iops_limit, &iops_wait)) {
>> + bps_wait = tg_within_bps_limit(tg, bio, bps_limit);
>> + iops_wait = tg_within_iops_limit(tg, bio, iops_limit);
>> + if (bps_wait + iops_wait == 0) {
>> if (wait)
>> *wait = 0;
>> return true;
>
> So, max_wait is supposed to be maximum in the whole traversal path in the
> tree, not just the max value in this tg, so after this, the code should be
> changed to sth like the following, right?
>
> max_wait = max(max, max(bps_wait, iops_wait));
>
> Thanks.
>
--
Best wishes
Kemeng Shi
next prev parent reply other threads:[~2022-11-24 12:10 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 6:03 [PATCH 00/11] A few bugfix and cleanup patches for blk-throttle Kemeng Shi
2022-11-23 6:03 ` [PATCH 01/11] blk-throttle: Limit whole system if root group is configured when on the default hierarchy Kemeng Shi
2022-11-23 17:11 ` Tejun Heo
2022-11-24 11:47 ` Kemeng Shi
2022-11-23 6:03 ` [PATCH 02/11] blk-throttle: Fix that bps of child could exceed bps limited in parent Kemeng Shi
2022-11-23 18:09 ` Tejun Heo
2022-11-24 11:49 ` Kemeng Shi
2022-11-23 6:03 ` [PATCH 03/11] blk-throttle: ignore cgroup without io queued in blk_throtl_cancel_bios Kemeng Shi
2022-11-23 18:13 ` Tejun Heo
2022-11-23 6:03 ` [PATCH 04/11] blk-throttle: correct calculation of wait time in tg_may_dispatch Kemeng Shi
2022-11-23 18:18 ` Tejun Heo
2022-11-24 12:10 ` Kemeng Shi [this message]
2022-11-23 6:03 ` [PATCH 05/11] blk-throttle: simpfy low limit reached check in throtl_tg_can_upgrade Kemeng Shi
2022-11-23 18:26 ` Tejun Heo
2022-11-24 12:52 ` Kemeng Shi
2022-11-26 5:03 ` kernel test robot
2022-11-23 6:03 ` [PATCH 06/11] blk-throttle: fix typo in comment of throtl_adjusted_limit Kemeng Shi
2022-11-23 18:26 ` Tejun Heo
2022-11-23 6:03 ` [PATCH 07/11] blk-throttle: remove incorrect comment for tg_last_low_overflow_time Kemeng Shi
2022-11-23 18:27 ` Tejun Heo
2022-11-23 6:03 ` [PATCH 08/11] blk-throttle: remove repeat check of elapsed time from last upgrade in throtl_hierarchy_can_downgrade Kemeng Shi
2022-11-23 18:28 ` Tejun Heo
2022-11-24 12:58 ` Kemeng Shi
2022-11-26 8:15 ` kernel test robot
2022-11-23 6:03 ` [PATCH 09/11] blk-throttle: remove unnecessary check for validation of limit index Kemeng Shi
2022-11-23 18:31 ` Tejun Heo
2022-11-24 12:58 ` Kemeng Shi
2022-11-23 6:04 ` [PATCH 10/11] blk-throttle: remove unused variable td in tg_update_has_rules Kemeng Shi
2022-11-23 18:30 ` Tejun Heo
2022-11-23 6:04 ` [PATCH 11/11] blk-throttle: Use more siutable time_after check for update slice_start Kemeng Shi
2022-11-23 18:29 ` Tejun Heo
2022-11-24 13:02 ` Kemeng Shi
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=fdf1aa87-b459-172a-f3f0-31afcb696c76@huawei.com \
--to=shikemeng@huawei.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=tj@kernel.org \
/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®