2017-07-20 16:58:48

by Victor Aoqui

[permalink] [raw]
Subject: [PATCH v2] powerpc/mm: Implemented default_hugepagesz verification for powerpc

Implemented default hugepage size verification (default_hugepagesz=)
in order to allow allocation of defined number of pages (hugepages=)
only for supported hugepage sizes.

Signed-off-by: Victor Aoqui <[email protected]>
---
v2:

- Renamed default_hugepage_setup_sz function to hugetlb_default_size_setup;

- Added powerpc string to error message.

arch/powerpc/mm/hugetlbpage.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index e1bf5ca..3a142fe 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -780,6 +780,21 @@ static int __init hugepage_setup_sz(char *str)
}
__setup("hugepagesz=", hugepage_setup_sz);

+static int __init hugetlb_default_size_setup(char *str)
+{
+ unsigned long long size;
+
+ size = memparse(str, &str);
+
+ if (add_huge_page_size(size) != 0) {
+ hugetlb_bad_size();
+ pr_err("Invalid powerpc default huge page size specified(%llu)\n", size);
+ }
+
+ return 1;
+}
+__setup("default_hugepagesz=", hugetlb_default_size_setup);
+
struct kmem_cache *hugepte_cache;
static int __init hugetlbpage_init(void)
{
--
1.8.3.1


2017-07-21 07:05:20

by Aneesh Kumar K.V

[permalink] [raw]
Subject: Re: [PATCH v2] powerpc/mm: Implemented default_hugepagesz verification for powerpc

Victor Aoqui <[email protected]> writes:

> Implemented default hugepage size verification (default_hugepagesz=)
> in order to allow allocation of defined number of pages (hugepages=)
> only for supported hugepage sizes.
>
> Signed-off-by: Victor Aoqui <[email protected]>
> ---
> v2:
>
> - Renamed default_hugepage_setup_sz function to hugetlb_default_size_setup;
>
> - Added powerpc string to error message.
>
> arch/powerpc/mm/hugetlbpage.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index e1bf5ca..3a142fe 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -780,6 +780,21 @@ static int __init hugepage_setup_sz(char *str)
> }
> __setup("hugepagesz=", hugepage_setup_sz);
>
> +static int __init hugetlb_default_size_setup(char *str)
> +{
> + unsigned long long size;
> +
> + size = memparse(str, &str);
> +
> + if (add_huge_page_size(size) != 0) {
> + hugetlb_bad_size();
> + pr_err("Invalid powerpc default huge page size specified(%llu)\n", size);
> + }
> +
> + return 1;
> +}
> +__setup("default_hugepagesz=", hugetlb_default_size_setup);
> +

this means we don't core the core function hugetlb_default_setup().
Hence the value default_hstate_size = 0 which means different value
for default_hstate_idx. We use that for hugetlbfs mount.

> struct kmem_cache *hugepte_cache;
> static int __init hugetlbpage_init(void)
> {
> --
> 1.8.3.1