From patchwork Thu Feb 15 04:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 13557362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF56C4829E for ; Thu, 15 Feb 2024 04:34:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 53A5D6B00AD; Wed, 14 Feb 2024 23:34:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C3346B00AE; Wed, 14 Feb 2024 23:34:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38C4F6B00AF; Wed, 14 Feb 2024 23:34:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 24E726B00AD for ; Wed, 14 Feb 2024 23:34:17 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 746B4120E1D for ; Thu, 15 Feb 2024 04:34:16 +0000 (UTC) X-FDA: 81792771312.23.17604C9 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf09.hostedemail.com (Postfix) with ESMTP id 772C014002E for ; Thu, 15 Feb 2024 04:34:13 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf09.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707971653; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=Wlb7EIrQcu+/ajrtKELDL96BSemy2YjP3iB0ItcdYP4=; b=UEj+Z08Ck5sa3gnwlyw37pRT0bgKZ4efABK/tpnElXuJgAhFvW4gCDKSTBCmdUFI9KXw9e dqRXEAUpR8Fss+el85qT7KA6tD9L/Hbq4rwuu6/+gFA+I8/I+v/Ys7IhEX9gtBsQmNcTEY Uan5K1kVI66dB96jP+R1BvPYp54d4Xs= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf09.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707971653; a=rsa-sha256; cv=none; b=FSZIhNsPeZqVrEGHIvHLZ/Fsk+VRxqvukgPsfUNIq8PDpkJFsuU/wYfesB8Hqmex7dEyI/ zTp5r2q0aGOh0sNzMxWylbFz0OCLHUXJejrI5SHMt9x7YK/A7br/XA/Eu8aVRavBZAheCQ EuOm2EG6xch4WEg12agpQA3OzGV2izQ= 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 06E2A1FB; Wed, 14 Feb 2024 20:34:53 -0800 (PST) Received: from a077893.arm.com (unknown [10.163.45.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 201CE3F7B4; Wed, 14 Feb 2024 20:34:09 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH V2] mm/hugetlb: Ensure adequate CMA areas available for hugetlb_cma[] Date: Thu, 15 Feb 2024 10:04:05 +0530 Message-Id: <20240215043405.2379295-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 772C014002E X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: pgsbqf7qo5fcypbdm69ussx7rpt6bew7 X-HE-Tag: 1707971653-242724 X-HE-Meta: U2FsdGVkX18s45RfgurZQxSlLt2wg2c5aP/Io/MXmXEPQCulX4hgwIfTOszO2uF+BCRoZwk6E39GSOlqe1TWY1+YF68UwXApYt67T7+sK8ek2GStEN6RMm2qXOaIGygUGx2kBain8OrJk7VHUUjaedUSVPZRmTAvJsqzotH8rudv2PJeuO9kXTtRALRY5ERorjONfJ38fiuJ/Wu5ZmMLWChXmggNW92czRkmvM4UyWhgMdA46rTgX/nmF3gfn2xe872E51SinPcy8ZWVSl92QMA+y+obsXV7gDV3MY7iZ12Yx6o+JYyUigTRnnJE2RwY90tNyMsWcrG4xbQrOcvN+lqrR+PQfiKYOR0cr1eHuR3qpe9e+PxOsjis1Px9RQi2oci6gdk/sblHYVf/gUOoKXDdzYSzicZfR2dvr9D9F4kydzlfYBBNfksYqZ6vCxr4WfQT/AhoSxjM7TtgLYiUxi5b9xlk0Ghw5AKXtxz4oEWuy0umhAwODlw/zpSkmVUNbi3HCvf6T6nGCm/KWPZCuKuM2W0gT0V/oLh5GqumYXdWT7xoeXOTrQJF7zASwYLy6BJDNdtNu17j9s5cg0m9mJiojBK8efJqu6wM5VYizWzxijLRGNWyHoYi3+p7QyW+IJMYj0UUJD5lP5qHSlNfNfBthWEZOJ72iAskPbBTSr/D6qB0odfwJ99zCyuGWieztbDHFFWAN/Ima3yMqTjcjrALC7mkvNyy2ryjW5bdCMCRMY1UbL4xHiJMqLIDBnneWXo+jadTg6JpNd25hg/Xsl1O4D3AnMQYuXD8qaWwFX3qAVVTK2jJ3XLo9SUvOfuiVDwfyD2FsSMiEllXAoqq7et3blg7RRnjiHVZwFjfszcLSbQ+jp2MxTcTw+Y167nRsd23CcIzvz2Do34NzXh1/DJgJPSqEzS3lwAxoK7yaV9hsOr2CNBfm7NDBWZBK+sEi7lEWBnVbjA6KCeghoh L4FEW4Qf NOdiDHgSP7l+1LXzCphO48cIxBr92S9X5wpClMiDPgIptpxBfa5XrNU7LcD6Ber0WTE68/vpFr0Q2kWaY5/VrF1xKmnsPdUBifpbqv71/FUl90+Nd7n66Ah35ne54j6kULIoIzLEJpNxhgmW+nCtuO1EsDqywos8GfYvDew0D+4bVEaB1WvW66i92KWv1+0Sje3RzZetAyhUqlyvf4W93d6yBmPFfbhGN9vH8JXGEu386G/hHztRZSSAT/Wj5UH0h+FY7ChVfkw4S99c3Q5qmkVIXgQMWA+dsVyekFIHzrTC6vrrP/NjHZefdANZQShMLo8dHbStF0OOVhdft69KPAD6rfwRuOiVkn5Owirc0WBzVDweBcJYyHz9d9YwiE2XWl5xl 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: List-Subscribe: List-Unsubscribe: HugeTLB CMA area array is being created for possible MAX_NUMNODES without ensuring corresponding MAX_CMA_AREAS support in CMA. This fails the build for such scenarios indicating need for CONFIG_CMA_AREAS adjustment. Cc: Muchun Song Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This patch applies on v6.8-rc4 Changes in V2: - Replaced VM_WARN_ON() with BUILD_BUG_ON() per Andrew Changes in V1: https://lore.kernel.org/all/20240209065036.1412670-1-anshuman.khandual@arm.com/ mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ed1581b670d4..30dc02e19616 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7743,6 +7743,13 @@ void __init hugetlb_cma_reserve(int order) } reserved = 0; + + /* + * There needs to be enough MAX_CMA_AREAS to accommodate + * MAX_NUMNODES heap areas being created here. Otherwise + * adjust CONFIG_CMA_AREAS as required. + */ + BUILD_BUG_ON(MAX_CMA_AREAS < MAX_NUMNODES); for_each_online_node(nid) { int res; char name[CMA_MAX_NAME];