linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: keith.busch@linux.intel.com (Keith Busch)
Subject: nvme: batch completions and do them outside of the queue lock
Date: Wed, 16 May 2018 20:09:20 -0600	[thread overview]
Message-ID: <20180517020920.GA21959@localhost.localdomain> (raw)
In-Reply-To: <909fe3ae-fe5a-fce6-20ea-a7f440799a06@kernel.dk>

On Wed, May 16, 2018@05:39:02PM -0600, Jens Axboe wrote:
>  static int __nvme_poll(struct nvme_queue *nvmeq, unsigned int tag)
>  {
> -	struct nvme_completion cqe;
> -	int found = 0, consumed = 0;
> +	u16 start, end;
>  
>  	if (!nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase))
>  		return 0;
>  
>  	spin_lock_irq(&nvmeq->q_lock);
> -	while (nvme_read_cqe(nvmeq, &cqe)) {
> -		nvme_handle_cqe(nvmeq, &cqe);
> -		consumed++;
> -
> -		if (tag == cqe.command_id) {
> -			found = 1;
> -			break;
> -		}
> -       }
> -
> -	if (consumed)
> -		nvme_ring_cq_doorbell(nvmeq);
> -	spin_unlock_irq(&nvmeq->q_lock);
> +	nvme_process_cq(nvmeq, &start, &end);
> +	spin_unlock(&nvmeq->q_lock);

You'll need to use the spin_unlock_irq() here, otherwise looks good.

  reply	other threads:[~2018-05-17  2:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 20:37 nvme: batch completions and do them outside of the queue lock Jens Axboe
2018-05-16 21:27 ` Keith Busch
2018-05-16 22:35   ` Keith Busch
2018-05-16 22:57     ` Jens Axboe
2018-05-16 23:10       ` Jens Axboe
2018-05-16 23:18         ` Jens Axboe
2018-05-16 23:39           ` Jens Axboe
2018-05-17  2:09             ` Keith Busch [this message]
2018-05-17  3:16               ` Jens Axboe
2018-05-17  3:16               ` Jens Axboe
2018-05-17  7:16             ` Christoph Hellwig
2018-05-17  7:51     ` Christoph Hellwig

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=20180517020920.GA21959@localhost.localdomain \
    --to=keith.busch@linux.intel.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;
as well as URLs for NNTP newsgroup(s).