From: chengkaitao <pilgrimtao@gmail.com>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Chengkaitao <chengkaitao@kylinos.cn>
Subject: [PATCH v2] block/mq-deadline: Remove redundant hctx pointer dereferencing operation
Date: Tue, 18 Nov 2025 09:25:39 +0800 [thread overview]
Message-ID: <20251118012539.61711-1-pilgrimtao@gmail.com> (raw)
From: Chengkaitao <chengkaitao@kylinos.cn>
The value of 'hctx->queue' is already stored in '*q' within
dd_insert_requests, we can directly reuse the result instead of
dereferencing hctx again in the dd_insert_request function. This
patch removes the redundant operation and modifies the function's
parameters accordingly. We can eliminate an LDR instruction.
Signed-off-by: Chengkaitao <chengkaitao@kylinos.cn>
---
v2:
1. Remove the changes related to bfq-iosched.
2. Add more commit message.
v1:
https://lore.kernel.org/all/20251016131651.83182-1-pilgrimtao@gmail.com/
---
block/mq-deadline.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index 3e741d33142d..5007d811a738 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -633,10 +633,9 @@ static bool dd_bio_merge(struct request_queue *q, struct bio *bio,
/*
* add rq to rbtree and fifo
*/
-static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
+static void dd_insert_request(struct request_queue *q, struct request *rq,
blk_insert_t flags, struct list_head *free)
{
- struct request_queue *q = hctx->queue;
struct deadline_data *dd = q->elevator->elevator_data;
const enum dd_data_dir data_dir = rq_data_dir(rq);
u16 ioprio = req_get_ioprio(rq);
@@ -694,7 +693,7 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx,
rq = list_first_entry(list, struct request, queuelist);
list_del_init(&rq->queuelist);
- dd_insert_request(hctx, rq, flags, &free);
+ dd_insert_request(q, rq, flags, &free);
}
spin_unlock(&dd->lock);
--
2.50.1 (Apple Git-155)
next reply other threads:[~2025-11-18 1:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 1:25 chengkaitao [this message]
2025-11-18 6:08 ` Christoph Hellwig
2025-11-18 7:24 ` Tao pilgrim
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=20251118012539.61711-1-pilgrimtao@gmail.com \
--to=pilgrimtao@gmail.com \
--cc=axboe@kernel.dk \
--cc=chengkaitao@kylinos.cn \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.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®