Skip to content

Commit 30f92d6

Browse files
mitaChristoph Hellwig
authored andcommitted
nvme-pci: use appropriate initial chunk size for HMB allocation
The initial chunk size for host memory buffer allocation is currently PAGE_SIZE << MAX_ORDER. MAX_ORDER order allocation is usually failed without CONFIG_DMA_CMA. So the HMB allocation is retried with chunk size PAGE_SIZE << (MAX_ORDER - 1) in general, but there is no problem if the retry allocation works correctly. Signed-off-by: Akinobu Mita <[email protected]> [hch: rebased] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Keith Busch <[email protected]> Cc: [email protected]
1 parent 92dc689 commit 30f92d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
16801680
u32 chunk_size;
16811681

16821682
/* start big and work our way down */
1683-
for (chunk_size = min_t(u64, preferred, PAGE_SIZE << MAX_ORDER);
1683+
for (chunk_size = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
16841684
chunk_size >= PAGE_SIZE * 2;
16851685
chunk_size /= 2) {
16861686
if (!__nvme_alloc_host_mem(dev, preferred, chunk_size)) {

0 commit comments

Comments
 (0)