From: Han Guangjiang <gj.han@foxmail.com>
To: yukuai1@huaweicloud.com
Cc: axboe@kernel.dk, fanggeng@lixiang.com, gj.han@foxmail.com,
hanguangjiang@lixiang.com, liangjie@lixiang.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yangchen11@lixiang.com, yukuai3@huawei.com
Subject: Re: [PATCH] blk-throttle: check policy bit in blk_throtl_activated()
Date: Thu, 4 Sep 2025 18:05:16 +0800 [thread overview]
Message-ID: <tencent_4D98FA22B5856469AC62088A7AC6D67CB009@qq.com> (raw)
In-Reply-To: <1f9c674a-9f5b-6c89-0504-1f6985095fa0@huaweicloud.com>
Hi,
>> static inline bool blk_throtl_activated(struct request_queue *q)
>> {
>> - return q->td != NULL;
>> + return q->td != NULL && test_bit(blkcg_policy_throtl.plid, q->blkcg_pols);
>> }
>
> You can just remove the fist checking, p->td must be set if policy is
> enabled. And please make blkcg_policy_enabled() inline function in
> blk-cgroup.h and use it here.
We intentionally kept the q->td != NULL check because we cannot guarantee
that the policy module is fully loaded when this function is called.
If the policy module is not loaded yet, blkcg_policy_throtl.plid might not be
assigned, which could cause the test_bit() check to be incorrect.
By keeping this check, we ensure that we have at least reached the cgroup
configuration flow, indicating that the policy loading is complete.
I'm wondering if there are any risks here and whether we should remove
the q->td != NULL check?
Thanks,
Han Guangjiang
next prev parent reply other threads:[~2025-09-04 10:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 12:39 gj.han
2025-09-02 17:06 ` Yu Kuai
2025-09-03 2:55 ` Han Guangjiang
2025-09-03 6:03 ` Yu Kuai
2025-09-03 7:21 ` Liang Jie
2025-09-03 8:24 ` Yu Kuai
2025-09-04 8:23 ` Han Guangjiang
2025-09-04 8:17 ` [PATCH v2] blk-throttle: fix access race during throttle policy activation Han Guangjiang
2025-09-04 9:18 ` Yu Kuai
2025-09-04 10:05 ` Han Guangjiang [this message]
2025-09-04 10:59 ` [PATCH] blk-throttle: check policy bit in blk_throtl_activated() Yu Kuai
2025-09-05 6:53 ` Han Guangjiang
2025-09-05 7:19 ` Yu Kuai
2025-09-04 8:19 ` Han Guangjiang
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=tencent_4D98FA22B5856469AC62088A7AC6D67CB009@qq.com \
--to=gj.han@foxmail.com \
--cc=axboe@kernel.dk \
--cc=fanggeng@lixiang.com \
--cc=hanguangjiang@lixiang.com \
--cc=liangjie@lixiang.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yangchen11@lixiang.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®