From: Nilay Shroff <nilay@linux.ibm.com>
To: Yu Kuai <yukuai1@huaweicloud.com>,
axboe@kernel.dk, yukuai3@huawei.com, bvanassche@acm.org,
hare@suse.de, ming.lei@redhat.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com,
johnny.chenyi@huawei.com
Subject: Re: [PATCH 03/16] blk-mq: remove useless checkings from blk_mq_update_nr_requests()
Date: Thu, 14 Aug 2025 17:53:41 +0530 [thread overview]
Message-ID: <97b63163-a122-48f0-805a-a06cf792903f@linux.ibm.com> (raw)
In-Reply-To: <20250814033522.770575-4-yukuai1@huaweicloud.com>
On 8/14/25 9:05 AM, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> 1) queue_requests_store() is the only caller of
> blk_mq_update_nr_requests(), where queue is already freezed, no need to
> check mq_freeze_depth;
> 2) q->tag_set must be set for request_based device, and queue_is_mq() is
> already checked in blk_mq_queue_attr_visible(), no need to check
> q->tag_set.
> 3) During initialization, hctx->tags in initialized before queue
> kobject, and during del_gendisk, queue kobject is deleted before
> exiting hctx, hence checking hctx->tags is useless.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
> block/blk-mq.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index b67d6c02eceb..3a219b7b3688 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -4921,24 +4921,15 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
> {
> struct blk_mq_tag_set *set = q->tag_set;
> struct blk_mq_hw_ctx *hctx;
> - int ret;
> + int ret = 0;
> unsigned long i;
>
> - if (WARN_ON_ONCE(!q->mq_freeze_depth))
> - return -EINVAL;
> -
> - if (!set)
> - return -EINVAL;
> -
> if (q->nr_requests == nr)
> return 0;
>
> blk_mq_quiesce_queue(q);
>
> - ret = 0;
> queue_for_each_hw_ctx(q, hctx, i) {
> - if (!hctx->tags)
> - continue;
It's possible that hctx->tags is set to NULL in case no software
queues are mapped to the hardware queue. So it seems that this
check is valid. Please see blk_mq_map_swqueue().
Thanks,
--Nilay
next prev parent reply other threads:[~2025-08-14 12:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 3:35 [PATCH 00/16] blk-mq: introduce new queue attribute asyc_dpeth Yu Kuai
2025-08-14 3:35 ` [PATCH 01/16] blk-mq-sched: add new parameter nr_requests in blk_mq_alloc_sched_tags() Yu Kuai
2025-08-14 8:16 ` Ming Lei
2025-08-14 8:55 ` Yu Kuai
2025-08-14 3:35 ` [PATCH 02/16] blk-mq: remove useless checking from queue_requests_store() Yu Kuai
2025-08-14 3:35 ` [PATCH 03/16] blk-mq: remove useless checkings from blk_mq_update_nr_requests() Yu Kuai
2025-08-14 12:23 ` Nilay Shroff [this message]
2025-08-15 1:32 ` Yu Kuai
2025-08-15 11:59 ` Nilay Shroff
2025-08-15 13:35 ` Ming Lei
2025-08-14 3:35 ` [PATCH 04/16] blk-mq: check invalid nr_requests in queue_requests_store() Yu Kuai
2025-08-14 3:35 ` [PATCH 05/16] blk-mq: fix elevator depth_updated method Yu Kuai
2025-08-14 3:35 ` [PATCH 06/16] blk-mq: cleanup shared tags case in blk_mq_update_nr_requests() Yu Kuai
2025-08-14 3:35 ` [PATCH 07/16] blk-mq: split bitmap grow and resize " Yu Kuai
2025-08-14 3:35 ` [PATCH 08/16] blk-mq: fix blk_mq_tags double free while nr_requests grown Yu Kuai
2025-08-14 8:20 ` Ming Lei
2025-08-14 12:15 ` Nilay Shroff
2025-08-15 1:54 ` Yu Kuai
2025-08-14 3:35 ` [PATCH 09/16] block: convert nr_requests to unsigned int Yu Kuai
2025-08-14 3:35 ` [PATCH 10/16] blk-mq-sched: unify elevators checking for async requests Yu Kuai
2025-08-14 3:35 ` [PATCH 11/16] blk-mq: add a new queue sysfs attribute async_depth Yu Kuai
2025-08-14 3:35 ` [PATCH 12/16] kyber: covert to use request_queue->async_depth Yu Kuai
2025-08-14 3:35 ` [PATCH 13/16] mq-deadline: " Yu Kuai
2025-08-14 3:35 ` [PATCH 14/16] block, bfq: convert " Yu Kuai
2025-08-14 3:35 ` [PATCH 15/16] blk-mq: fix stale nr_requests documentation Yu Kuai
2025-08-14 3:35 ` [PATCH 16/16] blk-mq: add documentation for new queue attribute async_dpeth Yu Kuai
2025-08-14 7:54 ` [PATCH 00/16] blk-mq: introduce new queue attribute asyc_dpeth Ming Lei
2025-08-14 8:22 ` Yu Kuai
2025-08-14 8:27 ` Ming Lei
2025-08-14 8:57 ` 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=97b63163-a122-48f0-805a-a06cf792903f@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=johnny.chenyi@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.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®