[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/7] block/nvme: switch to a NVMeRequest freelist
From: |
Sergio Lopez |
Subject: |
Re: [PATCH 4/7] block/nvme: switch to a NVMeRequest freelist |
Date: |
Mon, 25 May 2020 10:10:28 +0200 |
On Tue, May 19, 2020 at 06:11:35PM +0100, Stefan Hajnoczi wrote:
> There are three issues with the current NVMeRequest->busy field:
> 1. The busy field is accidentally accessed outside q->lock when request
> submission fails.
> 2. Waiters on free_req_queue are not woken when a request is returned
> early due to submission failure.
> 2. Finding a free request involves scanning all requests. This makes
> request submission O(n^2).
>
> Switch to an O(1) freelist that is always accessed under the lock.
>
> Also differentiate between NVME_QUEUE_SIZE, the actual SQ/CQ size, and
> NVME_NUM_REQS, the number of usable requests. This makes the code
> simpler than using NVME_QUEUE_SIZE everywhere and having to keep in mind
> that one slot is reserved.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> block/nvme.c | 81 ++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 54 insertions(+), 27 deletions(-)
Reviewed-by: Sergio Lopez <address@hidden>
signature.asc
Description: PGP signature
- [PATCH 1/7] block/nvme: poll queues without q->lock, (continued)
- [PATCH 1/7] block/nvme: poll queues without q->lock, Stefan Hajnoczi, 2020/05/19
- [PATCH 2/7] block/nvme: drop tautologous assertion, Stefan Hajnoczi, 2020/05/19
- [PATCH 3/7] block/nvme: don't access CQE after moving cq.head, Stefan Hajnoczi, 2020/05/19
- [PATCH 4/7] block/nvme: switch to a NVMeRequest freelist, Stefan Hajnoczi, 2020/05/19
- Re: [PATCH 4/7] block/nvme: switch to a NVMeRequest freelist,
Sergio Lopez <=
- [PATCH 5/7] block/nvme: clarify that free_req_queue is protected by q->lock, Stefan Hajnoczi, 2020/05/19
- [PATCH 6/7] block/nvme: keep BDRVNVMeState pointer in NVMeQueuePair, Stefan Hajnoczi, 2020/05/19
- [PATCH 7/7] block/nvme: support nested aio_poll(), Stefan Hajnoczi, 2020/05/19