nvme: batch completions and do them outside of the queue lock
Keith Busch
keith.busch at linux.intel.com
Wed May 16 19:09:20 PDT 2018
On Wed, May 16, 2018 at 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.
More information about the Linux-nvme
mailing list