From: Christoph Hellwig <hch@infradead.org>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] block: avoid hctx spinlock for plug with multiple queues
Date: Thu, 24 Apr 2025 04:38:19 -0700 [thread overview]
Message-ID: <aAoiq1AsoD-k_kp3@infradead.org> (raw)
In-Reply-To: <20250423205127.2976981-4-csander@purestorage.com>
> +static void blk_mq_extract_queue_requests(struct rq_list *rqs,
> + struct rq_list *queue_rqs,
> + unsigned *queue_depth)
> +{
> + struct rq_list matched_rqs = {}, unmatched_rqs = {};
> + struct request *rq = rq_list_pop(rqs);
> + struct request_queue *this_q = rq->q;
> + unsigned depth = 1;
> +
> + rq_list_add_tail(&matched_rqs, rq);
> + while ((rq = rq_list_pop(rqs))) {
> + if (rq->q == this_q) {
> + rq_list_add_tail(&matched_rqs, rq);
> + depth++;
> + } else {
> + rq_list_add_tail(&unmatched_rqs, rq);
> + }
This might be moe efficient if you keep an extra iterator and never
mode the request for another queue.
> + }
> +
> + *queue_rqs = matched_rqs;
> + *rqs = unmatched_rqs;
> + *queue_depth = depth;
.. and I'd return the queue depth here instead of making it another
output argument.
> +static void blk_mq_dispatch_multiple_queue_requests(struct rq_list *rqs)
> +{
> + do {
> + struct rq_list queue_rqs;
> + unsigned depth;
> +
> + blk_mq_extract_queue_requests(rqs, &queue_rqs, &depth);
> + blk_mq_dispatch_queue_requests(&queue_rqs, depth);
> + while (!rq_list_empty(&queue_rqs)) {
> + blk_mq_dispatch_list(&queue_rqs, false);
> + }
No need for the braces in the inner while loop here.
The other caller of blk_mq_dispatch_list loops until the list is empty,
why don't we need that here?
next prev parent reply other threads:[~2025-04-24 11:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 20:51 [PATCH 0/3] " Caleb Sander Mateos
2025-04-23 20:51 ` [PATCH 1/3] block: take rq_list instead of plug in dispatch functions Caleb Sander Mateos
2025-04-24 11:29 ` Christoph Hellwig
2025-04-23 20:51 ` [PATCH 2/3] block: factor out blk_mq_dispatch_queue_requests() helper Caleb Sander Mateos
2025-04-24 11:31 ` Christoph Hellwig
2025-04-23 20:51 ` [PATCH 3/3] block: avoid hctx spinlock for plug with multiple queues Caleb Sander Mateos
2025-04-24 11:38 ` Christoph Hellwig [this message]
2025-04-25 1:00 ` Caleb Sander Mateos
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=aAoiq1AsoD-k_kp3@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--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®