diff options
| author | Akinobu Mita <akinobu.mita@gmail.com> | 2017-09-06 06:15:31 -0400 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2017-09-11 12:29:38 -0400 |
| commit | 30f92d62e5b41a94de2d0bbd677a6ea2fcfed74f (patch) | |
| tree | 660a37a0ab5e90cda0ed1433570e2ec49a10114c | |
| parent | 92dc689563170b90ba844b8a2eb95e8a5eda2e83 (diff) | |
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 <akinobu.mita@gmail.com>
[hch: rebased]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Cc: stable@vger.kernel.org
| -rw-r--r-- | drivers/nvme/host/pci.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 82e23c867e42..a370f702fceb 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) | |||
| 1680 | u32 chunk_size; | 1680 | u32 chunk_size; |
| 1681 | 1681 | ||
| 1682 | /* start big and work our way down */ | 1682 | /* 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); |
| 1684 | chunk_size >= PAGE_SIZE * 2; | 1684 | chunk_size >= PAGE_SIZE * 2; |
| 1685 | chunk_size /= 2) { | 1685 | chunk_size /= 2) { |
| 1686 | if (!__nvme_alloc_host_mem(dev, preferred, chunk_size)) { | 1686 | if (!__nvme_alloc_host_mem(dev, preferred, chunk_size)) { |
