Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465208 > unrolled thread

[RFC PATCH] arm64/hugetlb enable gigantic hugepage

Started byXie Yisheng <xieyisheng1@huawei.com>
First post2016-08-18 14:10 +0200
Last post2016-08-19 13:30 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [RFC PATCH] arm64/hugetlb enable gigantic hugepage Xie Yisheng <xieyisheng1@huawei.com> - 2016-08-18 14:10 +0200
    Re: [RFC PATCH] arm64/hugetlb enable gigantic hugepage Yisheng Xie <xieyisheng1@huawei.com> - 2016-08-19 12:00 +0200
    Re: [RFC PATCH] arm64/hugetlb enable gigantic hugepage Michal Hocko <mhocko@kernel.org> - 2016-08-19 12:30 +0200
      Re: [RFC PATCH] arm64/hugetlb enable gigantic hugepage Yisheng Xie <xieyisheng1@huawei.com> - 2016-08-19 13:20 +0200
        Re: [RFC PATCH] arm64/hugetlb enable gigantic hugepage Michal Hocko <mhocko@kernel.org> - 2016-08-19 13:30 +0200

#1465208 — [RFC PATCH] arm64/hugetlb enable gigantic hugepage

FromXie Yisheng <xieyisheng1@huawei.com>
Date2016-08-18 14:10 +0200
Subject[RFC PATCH] arm64/hugetlb enable gigantic hugepage
Message-ID<s7uiZ-82P-23@gated-at.bofh.it>
As we know, arm64 also support gigantic hugepage eg. 1G.
So I try to use this function by adding hugepagesz=1G
in kernel parameters, with CONFIG_CMA=y.
However, when:
echo xx > /sys/kernel/mm/hugepages/hugepages-1048576kB/
          nr_hugepages
it failed with the info:
-bash: echo: write error: Invalid argument

This patch make gigantic hugepage can be used on arm64,
when CONFIG_CMA=y or other related configs is enable.

Signed-off-by: Xie Yisheng <xieyisheng1@huawei.com>
---
 mm/hugetlb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 87e11d8..b4d8048 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1022,7 +1022,8 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
 		((node = hstate_next_node_to_free(hs, mask)) || 1);	\
 		nr_nodes--)
 
-#if (defined(CONFIG_X86_64) || defined(CONFIG_S390)) && \
+#if (defined(CONFIG_X86_64) || defined(CONFIG_S390) || \
+	defined(CONFIG_ARM64)) && \
 	((defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || \
 	defined(CONFIG_CMA))
 static void destroy_compound_gigantic_page(struct page *page,
-- 
1.7.12.4

[toc] | [next] | [standalone]


#1466262

FromYisheng Xie <xieyisheng1@huawei.com>
Date2016-08-19 12:00 +0200
Message-ID<s7OKK-3Ya-15@gated-at.bofh.it>
In reply to#1465208
add more,

hi all,
Could anyone do me a favor and give some comments?

Thanks
Xie Yisheng

On 2016/8/18 20:05, Xie Yisheng wrote:
> As we know, arm64 also support gigantic hugepage eg. 1G.
> So I try to use this function by adding hugepagesz=1G
> in kernel parameters, with CONFIG_CMA=y.
> However, when:
> echo xx > /sys/kernel/mm/hugepages/hugepages-1048576kB/
>           nr_hugepages
> it failed with the info:
> -bash: echo: write error: Invalid argument
> 
> This patch make gigantic hugepage can be used on arm64,
> when CONFIG_CMA=y or other related configs is enable.
> 
> Signed-off-by: Xie Yisheng <xieyisheng1@huawei.com>
> ---
>  mm/hugetlb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 87e11d8..b4d8048 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1022,7 +1022,8 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
>  		((node = hstate_next_node_to_free(hs, mask)) || 1);	\
>  		nr_nodes--)
>  
> -#if (defined(CONFIG_X86_64) || defined(CONFIG_S390)) && \
> +#if (defined(CONFIG_X86_64) || defined(CONFIG_S390) || \
> +	defined(CONFIG_ARM64)) && \
>  	((defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || \
>  	defined(CONFIG_CMA))
>  static void destroy_compound_gigantic_page(struct page *page,
> 

[toc] | [prev] | [next] | [standalone]


#1466270

FromMichal Hocko <mhocko@kernel.org>
Date2016-08-19 12:30 +0200
Message-ID<s7PdL-4oN-17@gated-at.bofh.it>
In reply to#1465208
On Thu 18-08-16 20:05:29, Xie Yisheng wrote:
> As we know, arm64 also support gigantic hugepage eg. 1G.

Well, I do not know that. How can I check?

Anyway to the patch
[...]
> index 87e11d8..b4d8048 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1022,7 +1022,8 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
>  		((node = hstate_next_node_to_free(hs, mask)) || 1);	\
>  		nr_nodes--)
>  
> -#if (defined(CONFIG_X86_64) || defined(CONFIG_S390)) && \
> +#if (defined(CONFIG_X86_64) || defined(CONFIG_S390) || \
> +	defined(CONFIG_ARM64)) && \
>  	((defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || \
>  	defined(CONFIG_CMA))

this ifdef is getting pretty unwieldy. For one thing I think that
respective archs should enable ARCH_HAVE_GIGANTIC_PAGES.

>  static void destroy_compound_gigantic_page(struct page *page,
> -- 
> 1.7.12.4
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [next] | [standalone]


#1466295

FromYisheng Xie <xieyisheng1@huawei.com>
Date2016-08-19 13:20 +0200
Message-ID<s7Q0a-4Um-5@gated-at.bofh.it>
In reply to#1466270

On 2016/8/19 18:25, Michal Hocko wrote:
> On Thu 18-08-16 20:05:29, Xie Yisheng wrote:
>> As we know, arm64 also support gigantic hugepage eg. 1G.
> 
> Well, I do not know that. How can I check?
> 
Hi Michal,
Thank you for your reply.
Maybe you can check the setup_hugepagesz()
in ./arch/arm64/hugetlbpage.c
    if (ps == PMD_SIZE) {
        hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
    } else if (ps == PUD_SIZE) {
        hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
    } else if (ps == (PAGE_SIZE * CONT_PTES)) {
        hugetlb_add_hstate(CONT_PTE_SHIFT);
    } else if (ps == (PMD_SIZE * CONT_PMDS)) {
        hugetlb_add_hstate((PMD_SHIFT + CONT_PMD_SHIFT) - PAGE_SHIFT);
    } else {
        hugetlb_bad_size();
        pr_err("hugepagesz: Unsupported page size %lu K\n", ps >> 10);
        return 0;
    }

I think all of the supported hugepage size on arm64 should be listed here,
just as what X86_64 do. Therefore, I also a litter confuse about why not
enable it in hugetlb.c, though I have do some sanity test about 1G hugetlb
on arm64 and didn't find any bug.

Do I miss something?

Thanks
Xie Yisheng

> Anyway to the patch
> [...]
>> index 87e11d8..b4d8048 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -1022,7 +1022,8 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed)
>>  		((node = hstate_next_node_to_free(hs, mask)) || 1);	\
>>  		nr_nodes--)
>>  
>> -#if (defined(CONFIG_X86_64) || defined(CONFIG_S390)) && \
>> +#if (defined(CONFIG_X86_64) || defined(CONFIG_S390) || \
>> +	defined(CONFIG_ARM64)) && \
>>  	((defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || \
>>  	defined(CONFIG_CMA))
> 
> this ifdef is getting pretty unwieldy. For one thing I think that
> respective archs should enable ARCH_HAVE_GIGANTIC_PAGES.

I couldn't agree more about it, and will send another version, soon.

> 
>>  static void destroy_compound_gigantic_page(struct page *page,
>> -- 
>> 1.7.12.4
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to majordomo@kvack.org.  For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

[toc] | [prev] | [next] | [standalone]


#1466299

FromMichal Hocko <mhocko@kernel.org>
Date2016-08-19 13:30 +0200
Message-ID<s7Q9P-4Yv-7@gated-at.bofh.it>
In reply to#1466295
On Fri 19-08-16 19:08:51, Yisheng Xie wrote:
> 
> 
> On 2016/8/19 18:25, Michal Hocko wrote:
> > On Thu 18-08-16 20:05:29, Xie Yisheng wrote:
> >> As we know, arm64 also support gigantic hugepage eg. 1G.
> > 
> > Well, I do not know that. How can I check?
> > 
> Hi Michal,
> Thank you for your reply.
> Maybe you can check the setup_hugepagesz()

OK, I see. The support was added by 084bd29810a5 ("ARM64: mm: HugeTLB
support.") in 3.11 but this got later broken. I suspect 944d9fec8d7a
("hugetlb: add support for gigantic page allocation at runtime") in
3.16 but this would require double checking. Information like this would
be really helpful in the changelog...
-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web