Skip to contentSkip to conversation

riscv: Add support to allocate gigantic hugepages using CMA

PATCH Superseded Kefeng Wang 2 participants 3 messages Jul 30, 2021 RISC-V

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

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

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

Cc Alexandre Ghiti <[email protected]>

---
v2: don't disable hugepage support on RV32.

 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
reviewer Reviewed-by on v2 1/1
#1 lore raw

Le 30/07/2021 à 03:30, Kefeng Wang a écrit :

Quoted 1 line

commit 9e953cda5cdf ("riscv: Introduce huge page support for32/64bit

"Commit"

Quoted 1 line

kernel") add support gigantic hugepage support for RV64.

"adds support for gigantic huge pages for RV64."

Quoted 2 lines

This patch add support to allocate gigantic hugepages using CMA by

"adds"

Quoted 24 lines

specifying the hugetlb_cma= kernel parameter on RV64.

Cc Alexandre Ghiti <[email protected]>

---
v2: don't disable hugepage support on RV32.

  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 224

Quoted 8 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();
  }
 

Apart from the minor nits above, you can add:

Thanks!

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

#2 lore raw
Quoted 46 lines · Alex Ghiti

Le 30/07/2021 à 03:30, Kefeng Wang a écrit :

Quoted 1 line

commit 9e953cda5cdf ("riscv: Introduce huge page support for32/64bit

"Commit"

Quoted 1 line

kernel") add support gigantic hugepage support for RV64.

"adds support for gigantic huge pages for RV64."

Quoted 2 lines

This patch add support to allocate gigantic hugepages using CMA by

"adds"

Quoted 22 lines

specifying the hugetlb_cma= kernel parameter on RV64.

Cc Alexandre Ghiti <[email protected]>

---
v2: don't disable hugepage support on RV32.

  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();
   }
 

Apart from the minor nits above, you can add:

Quoted 2 lines

Resend with update, thanks :)

Quoted 4 lines

Thanks!

.

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