]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-pci: reverse request order in nvme_queue_rqs
authorChristoph Hellwig <hch@lst.de>
Wed, 13 Nov 2024 15:20:41 +0000 (16:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:52:48 +0000 (13:52 +0100)
commit0595c647d45f6599e7e9cc63df8361e7f6bf59a0
tree44f9cef754a90b3e682df0dbc646a82f8fc9efc1
parent25a5acf88fed59e060405bbb48098f4a3a2c2adc
nvme-pci: reverse request order in nvme_queue_rqs

[ Upstream commit beadf0088501d9dcf2454b05d90d5d31ea3ba55f ]

blk_mq_flush_plug_list submits requests in the reverse order that they
were submitted, which leads to a rather suboptimal I/O pattern especially
in rotational devices.  Fix this by rewriting nvme_queue_rqs so that it
always pops the requests from the passed in request list, and then adds
them to the head of a local submit list.  This actually simplifies the
code a bit as it removes the complicated list splicing, at the cost of
extra updates of the rq_next pointer.  As that should be cache hot
anyway it should be an easy price to pay.

Fixes: d62cbcf62f2f ("nvme: add support for mq_ops->queue_rqs()")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241113152050.157179-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/pci.c