From: Tejun Heo <tj@kernel.org>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: axboe@kernel.dk, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yukuai3@huawei.com, yi.zhang@huawei.com
Subject: Re: [PATCH 4/4] blk-throttle: cleanup throtl_dequeue_tg()
Date: Tue, 23 Aug 2022 08:34:10 -1000 [thread overview]
Message-ID: <YwUdouGld9Z7K8r1@slm.duckdns.org> (raw)
In-Reply-To: <20220823013810.406075-5-yukuai1@huaweicloud.com>
On Tue, Aug 23, 2022 at 09:38:10AM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> Now that throtl_dequeue_tg() is called when the last bio is dispatched,
> there is no need to check the flag THROTL_TG_PENDING, since it's ensured
> to be set when bio is throttled.
>
> There are no functional changes.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> block/blk-throttle.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
> index 47142a1dd102..e47506a8ef47 100644
> --- a/block/blk-throttle.c
> +++ b/block/blk-throttle.c
> @@ -570,14 +570,11 @@ static void throtl_enqueue_tg(struct throtl_grp *tg)
>
> static void throtl_dequeue_tg(struct throtl_grp *tg)
> {
> - if (tg->flags & THROTL_TG_PENDING) {
> - struct throtl_service_queue *parent_sq =
> - tg->service_queue.parent_sq;
> + struct throtl_service_queue *parent_sq = tg->service_queue.parent_sq;
>
> - throtl_rb_erase(&tg->rb_node, parent_sq);
> - --parent_sq->nr_pending;
> - tg->flags &= ~THROTL_TG_PENDING;
> - }
> + throtl_rb_erase(&tg->rb_node, parent_sq);
> + --parent_sq->nr_pending;
> + tg->flags &= ~THROTL_TG_PENDING;
Yeah, I don't know about this one. This breaks the symmetry with
throtl_enqueue_tg() and it's a bit odd that we aren't at least
WARN_ON_ONCE() on the flag given what the flag tracks. If you want to do
this, I think the prev approach of just removing the flag is better as that
was symmetric at least.
Thanks.
--
tejun
next prev parent reply other threads:[~2022-08-23 19:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 1:38 [PATCH 0/4] blk-throttle cleanups Yu Kuai
2022-08-23 1:38 ` [PATCH 1/4] blk-throttle: use 'READ/WRITE' instead of '0/1' Yu Kuai
2022-08-23 1:38 ` [PATCH 2/4] blk-throttle: calling throtl_dequeue/enqueue_tg in pairs Yu Kuai
2022-08-23 1:38 ` [PATCH 3/4] blk-throttle: cleanup tg_update_disptime() Yu Kuai
2022-08-23 18:29 ` Tejun Heo
2022-08-23 1:38 ` [PATCH 4/4] blk-throttle: cleanup throtl_dequeue_tg() Yu Kuai
2022-08-23 18:34 ` Tejun Heo [this message]
2022-08-24 1:19 ` Yu Kuai
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=YwUdouGld9Z7K8r1@slm.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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