From: David Hildenbrand <david@redhat.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: Ensure that HUGETLB_PAGE_ORDER is less than MAX_ORDER
Date: Fri, 9 Apr 2021 10:24:18 +0200 [thread overview]
Message-ID: <5a92f302-1917-1374-a8c7-0badb9ec1b8c@redhat.com> (raw)
In-Reply-To: <1617947717-2424-1-git-send-email-anshuman.khandual@arm.com>
On 09.04.21 07:55, Anshuman Khandual wrote:
> pageblock_order must always be less than MAX_ORDER, otherwise it might lead
> to an warning during boot. A similar problem got fixed on arm64 platform
> with the commit 79cc2ed5a716 ("arm64/mm: Drop THP conditionality from
> FORCE_MAX_ZONEORDER"). Assert the above condition before HUGETLB_PAGE_ORDER
> gets assigned as pageblock_order. This will help detect the problem earlier
> on platforms where HUGETLB_PAGE_SIZE_VARIABLE is enabled.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> mm/page_alloc.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 604dcd69397b..81b7460e1228 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7068,10 +7068,17 @@ void __init set_pageblock_order(void)
> if (pageblock_order)
> return;
>
> - if (HPAGE_SHIFT > PAGE_SHIFT)
> + if (HPAGE_SHIFT > PAGE_SHIFT) {
> + /*
> + * pageblock_order must always be less than
> + * MAX_ORDER. So does HUGETLB_PAGE_ORDER if
> + * that is being assigned here.
> + */
> + WARN_ON(HUGETLB_PAGE_ORDER >= MAX_ORDER);
Can't that be a BUILD_BUG_ON() ?
> order = HUGETLB_PAGE_ORDER;
> - else
> + } else {
> order = MAX_ORDER - 1;
> + }
>
> /*
> * Assume the largest contiguous order of interest is a huge page.
>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2021-04-09 8:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 5:55 Anshuman Khandual
2021-04-09 8:24 ` David Hildenbrand [this message]
2021-04-09 8:37 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a92f302-1917-1374-a8c7-0badb9ec1b8c@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox