gain NVMe SQ in-flight entries #
Keith Busch
keith.busch at intel.com
Fri Jul 8 16:22:20 PDT 2016
On Fri, Jul 08, 2016 at 06:03:33PM -0500, Huaicheng Li wrote:
> Hi all,
>
> (1). When nvme_queue_rq() queues a new I/O to the SQ, why doesn't it
> check whether the SQ is full or not?
It can never be full. We don't preallocate enough tags to fill it.
> Similarly, when nvme_process_rq() handles a CQE, it seems not checking
> whether CQ is empty? Why is that?
Huh? We check the phase bits to know if there's a new entry.
> (2). Why does nvme_queue_rq() need to call __nvme_process_cq()?? That
> should be the job of interrupt handler or poll().
> Anything missing here?
It's a micro optimization. We already hold the queue lock, might as well
opprotunistically see if there's any work completed. Worst case scenario
is nothing happens.
> (3). Is there an easy way to figure out how many entries are in the
> SQ?
You can see how many are active on any given queue by reading the "tags"
file under /sys/block/nvmeXnY/mq/<queue>/tags
The tags are shared among multiple namespaces, so you only need to
query one's mq tags file see how many are active.
> We can know where SQ_tail is in nvme_queue structure, how can the
> host know where the queue's head is **immediately**?
The host doesn't really know where the SQ head is. Only the controller
knows that, though it does provide a hint on each completion queue entry
where it was at the time the CQE was posted.
Assuming you mean the SQ tail, you can't view that without writing some
additional code to expose this to a user. But why do you even want to
know this?
More information about the Linux-nvme
mailing list