From: akinobu.mita@gmail.com (Akinobu Mita)
Subject: [PATCH 2/2] nvme-pci: use appropriate initial chunk size for HMB allocation
Date: Tue, 5 Sep 2017 00:23:30 +0900 [thread overview]
Message-ID: <1504538610-15670-3-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1504538610-15670-1-git-send-email-akinobu.mita@gmail.com>
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.
This change just avoids the retry and "failed to allocate host memory
buffer." warning in the most common case.
Cc: Keith Busch <keith.busch at intel.com>
Cc: Jens Axboe <axboe at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
---
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 7e71cc9..49e2e7f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1619,7 +1619,7 @@ static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
u64 size, tmp;
/* start big and work our way down */
- chunk_size = min(preferred, (u64)PAGE_SIZE << MAX_ORDER);
+ chunk_size = min(preferred, (u64)PAGE_SIZE * MAX_ORDER_NR_PAGES);
retry:
i = 0;
size = 0;
--
2.7.4
next prev parent reply other threads:[~2017-09-04 15:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 15:23 [PATCH 0/2] nvme-pci: fix rety handling of host memory buffer allocation Akinobu Mita
2017-09-04 15:23 ` [PATCH 1/2] nvme-pci: avoid arrary index out of bounds in retry HMB allocation Akinobu Mita
2017-09-04 20:03 ` Christoph Hellwig
2017-09-05 12:56 ` Akinobu Mita
2017-09-04 15:23 ` Akinobu Mita [this message]
2017-09-04 20:05 ` [PATCH 2/2] nvme-pci: use appropriate initial chunk size for " Christoph Hellwig
2017-09-05 12:58 ` Akinobu Mita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504538610-15670-3-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox