summaryrefslogtreecommitdiff
path: root/drivers/nvdimm/pmem.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-05-14 05:45:59 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-05-14 05:45:59 -0300
commitc91265cd0efb83778f015b4d4b1129bd2cfd075e (patch)
treec9e2ebed36b5a70f0d7c58cb7e3d36e823ccde9f /drivers/nvdimm/pmem.c
parenta5cdf7364020a61375af3c8aa23e09181f5c2c6c (diff)
Linux-libre 4.5.4-gnupck-4.5.4-gnu
Diffstat (limited to 'drivers/nvdimm/pmem.c')
-rw-r--r--drivers/nvdimm/pmem.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 544b802a5..02c574f8c 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -314,9 +314,16 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn)
* implementation will limit the pfns advertised through
* ->direct_access() to those that are included in the memmap.
*/
- if (nd_pfn->mode == PFN_MODE_PMEM)
- offset = ALIGN(SZ_8K + 64 * npfns, nd_pfn->align);
- else if (nd_pfn->mode == PFN_MODE_RAM)
+ if (nd_pfn->mode == PFN_MODE_PMEM) {
+ unsigned long memmap_size;
+
+ /*
+ * vmemmap_populate_hugepages() allocates the memmap array in
+ * HPAGE_SIZE chunks.
+ */
+ memmap_size = ALIGN(64 * npfns, PMD_SIZE);
+ offset = ALIGN(SZ_8K + memmap_size, nd_pfn->align);
+ } else if (nd_pfn->mode == PFN_MODE_RAM)
offset = ALIGN(SZ_8K, nd_pfn->align);
else
goto err;