public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: fix host memory buffer allocation size
@ 2022-04-28 10:19 Thomas Weißschuh
  2022-04-28 14:36 ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Weißschuh @ 2022-04-28 10:19 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-kernel
  Cc: linux-nvme, Thomas Weißschuh

We want to allocate the smallest possible amount of buffers with the
largest possible size (1 buffer of size "hmpre").

Previously we were allocating as many buffers as possible of the smallest
possible size.
This also lead to "hmpre" to not be satisifed as not enough buffer slots
where available.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---

Also discussed at https://lore.kernel.org/linux-nvme/f94565db-f217-4a56-83c3-c6429807185c@t-8ch.de/

 drivers/nvme/host/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 3aacf1c0d5a5..0546523cc20b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2090,7 +2090,7 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
 
 static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
 {
-	u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
+	u64 min_chunk = max_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
 	u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2);
 	u64 chunk_size;
 

base-commit: 46cf2c613f4b10eb12f749207b0fd2c1bfae3088
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-25 15:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-28 10:19 [PATCH] nvme-pci: fix host memory buffer allocation size Thomas Weißschuh
2022-04-28 14:36 ` Christoph Hellwig
2022-04-28 14:44   ` Thomas Weißschuh
2022-04-28 15:06     ` Christoph Hellwig
2022-04-28 16:09       ` Thomas Weißschuh
2022-05-10  7:03         ` Christoph Hellwig
2022-05-10 10:20           ` Thomas Weißschuh
2022-05-25 15:07             ` Thomas Weißschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox