[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7583dfcc-62d8-2a54-6eef-bcb4e01129b3@gmail.com>
Date: Mon, 27 Apr 2020 10:34:36 +0530
From: Sandipan Das <sandipan.osd@...il.com>
To: Mike Kravetz <mike.kravetz@...cle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, sparclinux@...r.kernel.org,
linux-doc@...r.kernel.org,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ibm.com>,
"David S . Miller" <davem@...emloft.net>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Jonathan Corbet <corbet@....net>,
Longpeng <longpeng2@...wei.com>,
Christophe Leroy <christophe.leroy@....fr>,
Randy Dunlap <rdunlap@...radead.org>,
Mina Almasry <almasrymina@...gle.com>,
Peter Xu <peterx@...hat.com>,
Nitesh Narayan Lal <nitesh@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3 2/4] hugetlbfs: move hugepagesz= parsing to arch
independent code
Hi Mike,
On 18/04/20 12:20 am, Mike Kravetz wrote:
> Now that architectures provide arch_hugetlb_valid_size(), parsing
> of "hugepagesz=" can be done in architecture independent code.
> Create a single routine to handle hugepagesz= parsing and remove
> all arch specific routines. We can also remove the interface
> hugetlb_bad_size() as this is no longer used outside arch independent
> code.
>
> This also provides consistent behavior of hugetlbfs command line
> options. The hugepagesz= option should only be specified once for
> a specific size, but some architectures allow multiple instances.
> This appears to be more of an oversight when code was added by some
> architectures to set up ALL huge pages sizes.
>
> [...]
>
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index de54d2a37830..2c3fa0a7787b 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -589,21 +589,6 @@ static int __init add_huge_page_size(unsigned long long size)
> return 0;
> }
>
> -static int __init hugepage_setup_sz(char *str)
> -{
> - unsigned long long size;
> -
> - size = memparse(str, &str);
> -
> - if (add_huge_page_size(size) != 0) {
> - hugetlb_bad_size();
> - pr_err("Invalid huge page size specified(%llu)\n", size);
> - }
> -
> - return 1;
> -}
> -__setup("hugepagesz=", hugepage_setup_sz);
> -
> [...]
This isn't working as expected on powerpc64.
[ 0.000000] Kernel command line: root=UUID=dc7b49cf-95a2-4996-8e7d-7c64ddc7a6ff hugepagesz=16G hugepages=2
[ 0.000000] HugeTLB: huge pages not supported, ignoring hugepagesz = 16G
[ 0.000000] HugeTLB: huge pages not supported, ignoring hugepages = 2
[ 0.284177] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages
[ 0.284182] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages
[ 2.585062] hugepagesz=16G
[ 2.585063] hugepages=2
The "huge pages not supported" messages are under a !hugepages_supported()
condition which checks if HPAGE_SHIFT is non-zero. On powerpc64, HPAGE_SHIFT
comes from the hpage_shift variable. At this point, it is still zero and yet
to be set. Hence the check fails. The reason being hugetlbpage_init_default(),
which sets hpage_shift, it now called after hugepage_setup_sz().
- Sandipan
Powered by blists - more mailing lists