Skip to contentSkip to conversation

riscv: Add support to allocate gigantic hugepages using CMA

PATCH In review Kefeng Wang 2 participants 2 messages Jul 30, 2021 – Aug 14, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 riscv: Add support to allocate gigantic hugepages using CMA

Commit 9e953cda5cdf ("riscv: Introduce huge page support for32/64bit kernel") adds support gigantic hugepage support for RV64.

This patch adds support to allocate gigantic hugepages using CMA by specifying the hugetlb_cma= kernel parameter on RV64.

---
v3: Update changelog and add Reviewed-by.

 arch/riscv/mm/init.c | 3 +++
 1 file changed, 3 insertions(+)
arch/riscv/mm/init.c +3 -0
index a14bf3910eec..e547e53cddd2 100644
@@ -19,6 +19,7 @@
 #include <linux/set_memory.h>
 #include <linux/dma-map-ops.h>
 #include <linux/crash_dump.h>
+#include <linux/hugetlb.h>
 
 #include <asm/fixmap.h>
 #include <asm/tlbflush.h>
@@ -216,6 +217,8 @@ static void __init setup_bootmem(void)
 
 	early_init_fdt_scan_reserved_mem();
 	dma_contiguous_reserve(dma32_phys_limit);
+	if (IS_ENABLED(CONFIG_64BIT))
+		hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
 	memblock_allow_resize();
 }
 
Signature · 7 lines
2.26.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#1 lore raw
Quoted 27 lines · On Fri, 30 Jul 2021 05:48:41 PDT (-0700), [email protected] wrote:

Commit 9e953cda5cdf ("riscv: Introduce huge page support for32/64bit kernel") adds support gigantic hugepage support for RV64.

This patch adds support to allocate gigantic hugepages using CMA by specifying the hugetlb_cma= kernel parameter on RV64.

---
v3: Update changelog and add Reviewed-by.

 arch/riscv/mm/init.c | 3 +++
 1 file changed, 3 insertions(+)
arch/riscv/mm/init.c +1 -0
index a14bf3910eec..e547e53cddd2 100644
@@ -19,6 +19,7 @@
 #include <linux/set_memory.h>
 #include <linux/dma-map-ops.h>
 #include <linux/crash_dump.h>
+#include <linux/hugetlb.h>
 
 #include <asm/fixmap.h>
 #include <asm/tlbflush.h>

arch/riscv/mm/init.c static void __init setup_bootmem(void) · line 223

Quoted 7 lines
arch/riscv/mm/init.c +2 -0
@@ -216,6 +217,8 @@ static void __init setup_bootmem(void)
 
 	early_init_fdt_scan_reserved_mem();
 	dma_contiguous_reserve(dma32_phys_limit);
+	if (IS_ENABLED(CONFIG_64BIT))
+		hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
 	memblock_allow_resize();
 }

Thanks. This is on for-next. I cleaned up the commit text a bit.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv