diff mbox series

[v2] riscv: Add support to allocate gigantic hugepages using CMA

Message ID 20210730013017.50651-1-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2] riscv: Add support to allocate gigantic hugepages using CMA | expand

Commit Message

Kefeng Wang July 30, 2021, 1:30 a.m. UTC
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 <alex@ghiti.fr>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v2: don't disable hugepage support on RV32.

 arch/riscv/mm/init.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Alexandre Ghiti July 30, 2021, 12:09 p.m. UTC | #1
Le 30/07/2021 à 03:30, Kefeng Wang a écrit :
> commit 9e953cda5cdf ("riscv: Introduce huge page support for32/64bit

"Commit"

> kernel") add support gigantic hugepage support for RV64.

"adds support for gigantic huge pages for RV64."

> 
> This patch add support to allocate gigantic hugepages using CMA by

"adds"

> specifying the hugetlb_cma= kernel parameter on RV64.
> 
> Cc: Alexandre Ghiti <alex@ghiti.fr>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v2: don't disable hugepage support on RV32.
> 
>   arch/riscv/mm/init.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index a14bf3910eec..e547e53cddd2 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -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();
>   }
>   
> 

Apart from the minor nits above, you can add:

Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>

Thanks!
Kefeng Wang July 30, 2021, 1:01 p.m. UTC | #2
On 2021/7/30 20:09, Alex Ghiti wrote:
> Le 30/07/2021 à 03:30, Kefeng Wang a écrit :
>> commit 9e953cda5cdf ("riscv: Introduce huge page support for32/64bit
>
> "Commit"
>
>> kernel") add support gigantic hugepage support for RV64.
>
> "adds support for gigantic huge pages for RV64."
>
>>
>> This patch add support to allocate gigantic hugepages using CMA by
>
> "adds"
>
>> specifying the hugetlb_cma= kernel parameter on RV64.
>>
>> Cc: Alexandre Ghiti <alex@ghiti.fr>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>> v2: don't disable hugepage support on RV32.
>>
>>   arch/riscv/mm/init.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index a14bf3910eec..e547e53cddd2 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -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();
>>   }
>>
>
> Apart from the minor nits above, you can add:
>
> Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
>
Resend with update, thanks :)
> Thanks!
>
> .
>
diff mbox series

Patch

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index a14bf3910eec..e547e53cddd2 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -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();
 }