From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 2/4] nvme-pci: use appropriate initial chunk size for HMB allocation
Date: Wed, 6 Sep 2017 15:55:30 +0200 [thread overview]
Message-ID: <20170906135532.21358-3-hch@lst.de> (raw)
In-Reply-To: <20170906135532.21358-1-hch@lst.de>
From: Akinobu Mita <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.
Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
[hch: rebased]
Signed-off-by: Christoph Hellwig <hch at lst.de>
Cc: stable at vger.kernel.org
---
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 e3252bcbc58e..6d2acf06c180 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1680,7 +1680,7 @@ static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
u32 chunk_size;
/* start big and work our way down */
- for (chunk_size = min_t(u64, preferred, PAGE_SIZE << MAX_ORDER);
+ for (chunk_size = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
chunk_size >= PAGE_SIZE * 2;
chunk_size /= 2) {
if (!__nvme_alloc_host_mem(dev, preferred, chunk_size)) {
--
2.11.0
next prev parent reply other threads:[~2017-09-06 13:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 13:55 nvme host memory buffer fixes and updates Christoph Hellwig
2017-09-06 13:55 ` [PATCH 1/4] nvme-pci: fix host memory buffer allocation fallback Christoph Hellwig
2017-09-06 20:12 ` Keith Busch
2017-09-06 13:55 ` Christoph Hellwig [this message]
2017-09-06 20:13 ` [PATCH 2/4] nvme-pci: use appropriate initial chunk size for HMB allocation Keith Busch
2017-09-06 13:55 ` [PATCH 3/4] nvme-pci: propagate (some) errors from host memory buffer setup Christoph Hellwig
2017-09-06 14:19 ` Holger Hoffstätte
2017-09-06 20:27 ` Keith Busch
2017-09-06 21:49 ` Keith Busch
2017-09-06 13:55 ` [PATCH 4/4] nvme-pci: implement the HMB entry number and size limitations Christoph Hellwig
2017-09-06 20:11 ` Keith Busch
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=20170906135532.21358-3-hch@lst.de \
--to=hch@lst.de \
/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