From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EF9CC433B4 for ; Fri, 9 Apr 2021 08:37:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9FDD66102A for ; Fri, 9 Apr 2021 08:37:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FDD66102A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 235736B006C; Fri, 9 Apr 2021 04:37:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E5F66B006E; Fri, 9 Apr 2021 04:37:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 087146B0070; Fri, 9 Apr 2021 04:37:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id DF3C96B006C for ; Fri, 9 Apr 2021 04:37:12 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8098CA2AC for ; Fri, 9 Apr 2021 08:37:12 +0000 (UTC) X-FDA: 78012173904.02.142A3EB Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf23.hostedemail.com (Postfix) with ESMTP id 8DE13A00038C for ; Fri, 9 Apr 2021 08:37:10 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3B821FB; Fri, 9 Apr 2021 01:37:10 -0700 (PDT) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6BE023F694; Fri, 9 Apr 2021 01:37:09 -0700 (PDT) Subject: Re: [PATCH] mm/page_alloc: Ensure that HUGETLB_PAGE_ORDER is less than MAX_ORDER To: David Hildenbrand , linux-mm@kvack.org Cc: Andrew Morton , linux-kernel@vger.kernel.org References: <1617947717-2424-1-git-send-email-anshuman.khandual@arm.com> <5a92f302-1917-1374-a8c7-0badb9ec1b8c@redhat.com> From: Anshuman Khandual Message-ID: <2fde38dd-7556-4651-8623-321066e48861@arm.com> Date: Fri, 9 Apr 2021 14:07:59 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <5a92f302-1917-1374-a8c7-0badb9ec1b8c@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8DE13A00038C X-Stat-Signature: skpbshh7nw8dt5uaaei7tjteg181wrai Received-SPF: none (arm.com>: No applicable sender policy available) receiver=imf23; identity=mailfrom; envelope-from=""; helo=foss.arm.com; client-ip=217.140.110.172 X-HE-DKIM-Result: none/none X-HE-Tag: 1617957430-887380 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 4/9/21 1:54 PM, David Hildenbrand wrote: > 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 platfo= rm >> 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 ea= rlier >> on platforms where HUGETLB_PAGE_SIZE_VARIABLE is enabled. >> >> Cc: Andrew Morton >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> =C2=A0 mm/page_alloc.c | 11 +++++++++-- >> =C2=A0 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) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pageblock_order) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return; >> =C2=A0 -=C2=A0=C2=A0=C2=A0 if (HPAGE_SHIFT > PAGE_SHIFT) >> +=C2=A0=C2=A0=C2=A0 if (HPAGE_SHIFT > PAGE_SHIFT) { >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * pageblock_order mu= st always be less than >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * MAX_ORDER. So does= HUGETLB_PAGE_ORDER if >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * that is being assi= gned here. >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 WARN_ON(HUGETLB_PAGE_ORDER= >=3D MAX_ORDER); >=20 > Can't that be a BUILD_BUG_ON() ? Yes, it can be. Probably might be appropriate as well, given that both the arguments here are compile time constants. Okay, will change. >=20 >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 order =3D HUGET= LB_PAGE_ORDER; >> -=C2=A0=C2=A0=C2=A0 else >> +=C2=A0=C2=A0=C2=A0 } else { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 order =3D MAX_O= RDER - 1; >> +=C2=A0=C2=A0=C2=A0 } >> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * Assume the largest contiguous o= rder of interest is a huge page. >> >=20 >=20