All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 6/9] nvme: add support for batched completion of polled IO
Date: Thu, 14 Oct 2021 09:30:57 -0600	[thread overview]
Message-ID: <f42b215e-0126-d2c1-2548-b58aaf3cbb84@kernel.dk> (raw)
In-Reply-To: <YWffkZ2w/mhcJIAU@infradead.org>

On 10/14/21 1:43 AM, Christoph Hellwig wrote:
> On Wed, Oct 13, 2021 at 10:54:13AM -0600, Jens Axboe wrote:
>> +void nvme_complete_batch_req(struct request *req)
>> +{
>> +	nvme_cleanup_cmd(req);
>> +	nvme_end_req_zoned(req);
>> +	req->status = BLK_STS_OK;
>> +}
>> +EXPORT_SYMBOL_GPL(nvme_complete_batch_req);
>> +
> 
> I'd be tempted to just merge this helper into the only caller.
> nvme_cleanup_cmd is exported anyway, so this would just add an export
> for nvme_end_req_zoned.

Sure, I can do that.

>> +static __always_inline void nvme_complete_batch(struct io_batch *iob,
>> +						void (*fn)(struct request *rq))
>> +{
>> +	struct request *req;
>> +
>> +	req = rq_list_peek(&iob->req_list);
>> +	while (req) {
>> +		fn(req);
>> +		nvme_complete_batch_req(req);
>> +		req = rq_list_next(req);
>> +	}
>> +
>> +	blk_mq_end_request_batch(iob);
> 
> Can we turn this into a normal for loop?
> 
> 	for (req = rq_list_peek(&iob->req_list); req; req = rq_list_next(req)) {
> 		..
> 	}

If you prefer it that way for nvme, for me the while () setup is much
easier to read than a really long for line.

>> +	if (!nvme_try_complete_req(req, cqe->status, cqe->result)) {
>> +		/*
>> +		 * Do normal inline completion if we don't have a batch
>> +		 * list, if we have an end_io handler, or if the status of
>> +		 * the request isn't just normal success.
>> +		 */
>> +		if (!iob || req->end_io || nvme_req(req)->status)
>> +			nvme_pci_complete_rq(req);
>> +		else
>> +			rq_list_add_tail(&iob->req_list, req);
>> +	}
> 
> The check for the conditions where we can or cannot batch complete
> really should go into a block layer helper.  Something like the
> incremental patch below:

That's a good idea, I'll add that.

-- 
Jens Axboe


  reply	other threads:[~2021-10-14 15:31 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 16:54 [PATCHSET v2 0/9] Batched completions Jens Axboe
2021-10-13 16:54 ` [PATCH 1/9] block: define io_batch structure Jens Axboe
2021-10-14  5:45   ` Christoph Hellwig
2021-10-14 15:50     ` Jens Axboe
2021-10-14 16:06       ` Christoph Hellwig
2021-10-14 18:14         ` Jens Axboe
2021-10-13 16:54 ` [PATCH 2/9] block: add a struct io_batch argument to fops->iopoll() Jens Axboe
2021-10-13 16:54 ` [PATCH 3/9] sbitmap: add helper to clear a batch of tags Jens Axboe
2021-10-13 16:54 ` [PATCH 4/9] sbitmap: test bit before calling test_and_set_bit() Jens Axboe
2021-10-14  7:20   ` Hannes Reinecke
2021-10-14 13:01     ` Jens Axboe
2021-10-14 18:41   ` Bart Van Assche
2021-10-13 16:54 ` [PATCH 5/9] block: add support for blk_mq_end_request_batch() Jens Axboe
2021-10-14  7:32   ` Christoph Hellwig
2021-10-14 15:27     ` Jens Axboe
2021-10-13 16:54 ` [PATCH 6/9] nvme: add support for batched completion of polled IO Jens Axboe
2021-10-14  7:43   ` Christoph Hellwig
2021-10-14 15:30     ` Jens Axboe [this message]
2021-10-14 15:34       ` Jens Axboe
2021-10-14 16:07       ` Christoph Hellwig
2021-10-14 16:11         ` Jens Axboe
2021-10-13 16:54 ` [PATCH 7/9] block: assign batch completion handler in blk_poll() Jens Axboe
2021-10-14  7:48   ` Christoph Hellwig
2021-10-14 15:43     ` Jens Axboe
2021-10-13 16:54 ` [PATCH 8/9] io_uring: utilize the io_batch infrastructure for more efficient polled IO Jens Axboe
2021-10-14  8:03   ` Christoph Hellwig
2021-10-14 15:45     ` Jens Axboe
2021-10-14 16:08       ` Christoph Hellwig
2021-10-14 18:14         ` Jens Axboe
2021-10-16  4:29           ` Christoph Hellwig
2021-10-16 14:33             ` Jens Axboe
2021-10-13 16:54 ` [PATCH 9/9] nvme: wire up completion batching for the IRQ path Jens Axboe
2021-10-14  7:53   ` Christoph Hellwig
2021-10-14 15:49     ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2021-10-12 18:17 [PATCHSET 0/9] Batched completions Jens Axboe
2021-10-12 18:17 ` [PATCH 6/9] nvme: add support for batched completion of polled IO Jens Axboe
2021-10-13  7:08   ` Christoph Hellwig
2021-10-13 15:10     ` Jens Axboe
2021-10-13 15:16       ` Christoph Hellwig
2021-10-13 15:42         ` Jens Axboe
2021-10-13 15:49           ` Jens Axboe
2021-10-13 15:50           ` Christoph Hellwig
2021-10-13 16:04             ` Jens Axboe
2021-10-13 16:13               ` Christoph Hellwig
2021-10-13 16:33                 ` Jens Axboe
2021-10-13 16:45                   ` Jens Axboe
2021-10-13  9:09   ` John Garry
2021-10-13 15:07     ` Jens Axboe

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=f42b215e-0126-d2c1-2548-b58aaf3cbb84@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.