From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796298033; b=TKhetYFsaCyxFG7+bTs384S+5qQHZidF6t/L6wAgotyDFfbeiFfqPP8Losu6T4LLnICu EcuqDBhUPprjl2Onhtr297jdPd3h8DFpzIJBHFM+mkqzGAOHsfdVNCkNwtL9v6CaLtUX+ P+THQochql9wpnr85cbb+tcJLa5wAQUeOcJoRCoFvOSmc+hbYZ9Ed15AYVH43PHk0L3Y2 nxE+SS0jdgxaQB8CkB5MUPUTeDOb/BGXMa81otvI9OLgGT1cPRgjnXkiVUG+6nEYRM+GJ FUIttz+0S8Pyd69VXmA30ehOblfAE/VxOh5SRa+siMD/jVmgSNPxgUciZEdkZsmAsDg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796298033; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=mpslmmo7M1p9YubR+P2oBosAy4PFU4O2k+/LydEsUSM=; b=1X1E060Um/JMWLrpkMN70/8lUmt2lCNr6XADotzZ+nm+7O9QQji387dpQDPrqzNKOeWf T7dVQFcyRDfkM41KFpoRAC7UuAFlGT9xp+IlNv0iLl71eAwjFL6EA+Dt1lppZYRY1I/Dy Q/tcUF2/c8STUbglo24NghIAtPraqyoXZljktzQLkYXW9WsPRaSWCc+eijcoZCeVB/Lo1 fYUDkPQ6Lwz/NxIWtZIjFnJLkbL5d44gC8hNF8CJnM3Pnns0REmcM8kHynp04hRGg3Bbf OtmL80ySMjyyNRVihDIvgKeO3LBpaD3MlSC8z5Ronr2/ejJV5qFk81O4oPVsZ+lJmOw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ggtMpf6q; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5DFB606A32C; Thu, 3 Dec 2026 11:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ggtMpf6q Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11E681F000C1; Thu, 3 Dec 2026 11:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796298033; bh=mpslmmo7M1p9YubR+P2oBosAy4PFU4O2k+/LydEsUSM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ggtMpf6qKwDOLpjWMV0z+12CEdvzBDGMyXhr48vZ/p2NREeeZRDJ/bLtoFOKERXX4 8ylPX90DbU8ofS0bwjg7CDcdo3GlVzkldSz8m+dGsq0wes/gtynutvBC9i2AibujXM jk9bTcJpEgSb4b+5brhwLCsC5hUsKpHqRCVYSQd1gJAc+hrgiII6cm+BhhlLKjsJsT H6GSH0cTprWwbHkh/XC98MFgsXxaLK2r+l+39kFm+JZuqxs8KDPE/gAFLHPgm+1DQn +eF8QrK56uwj4YNHXRJnO7G6/v3Bdj4KqC24Y0Btj25RvVZ2IJQMZxQwoDlMHg6Zyw mPcbsSPye8sEw== From: "David Hildenbrand (Arm)" Date: Thu, 03 Dec 2026 12:37:34 +0100 Subject: [PATCH v2 11/35] mm/hugetlb_cma: reset hugetlb_cma_size if the arch doesn't support it X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261203-hugetlb_fixes_2-v2-11-9bbeabb555d2@kernel.org> References: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> In-Reply-To: <20261203-hugetlb_fixes_2-v2-0-9bbeabb555d2@kernel.org> To: Muchun Song , Oscar Salvador , Andrew Morton , Hongfu Li , Jinmeng Zhou , Mina Almasry , Davidlohr Bueso , Naoya Horiguchi , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Vivek Kasireddy , Mel Gorman , Hugh Dickins , Baolin Wang , Dave Airlie , Jason Gunthorpe , Andy Whitcroft , Roman Gushchin , Barry Song , Andrea Arcangeli , Lorenzo Stoakes , Suren Baghdasaryan , Shakeel Butt , Pedro Falcato , Jann Horn , Guillaume Morin , Yang Shi , James Houghton , Rik van Riel , Harry Yoo , Lance Yang , Axel Rasmussen , Peter Xu , Sasha Levin , Kiryl Shutsemau , Christian Brauner , "Steven Rostedt (Google)" , Hongbo Li , Gregory Price , Zi Yan , Joshua Hahn , Rakie Kim , Ying Huang , Matthew Brost , Byungchul Park , Alistair Popple , Andi Kleen , David Rientjes , Joern Engel , "Aneesh Kumar K.V" Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, Gerd Hoffmann , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Johannes Weiner , Chris Mason , Jiaqi Yan , Sashiko , "David Hildenbrand (Arm)" X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1817; i=david@kernel.org; h=from:subject:message-id; bh=kwlKipZ5xk2a5/PgDdcrgCXIlnfrNs26bnjAtMPPqtE=; b=owGbwMvMwCF2/OVpCdfQ3ZWMp9WSGLIFQ6qY6j5ZJX7JZT/dyiszQ7HIRORI8UKRR5WdPe/lb 1e2ZXt1lLIwiHEwyIopsgQF3zd4+XJdbbUbHzPMHFYmkCEMXJwCMBFOeYbfbMnWho5tzxlWa12b 2vZ2muDBrfO5/q2YsFdyelnVnINC9gz/XdMOyYVJv/c/+dKv0e/3ckV/8ykvG5d93WbmwPhHtdy XBwA= X-Developer-Key: i=david@kernel.org; a=openpgp; fpr=1BD9CAAD735C4C3A460DFCCA4DDE10F700FF835A With hugetlb_cma=, hugetlb_cma_reserve() reserves CMA areas for gigantic huge pages. If it ends up not reserving anything, it sets hugetlb_cma_size to 0, as it is the signal to the rest of hugetlb that the hugetlb CMA area exists. However, if the architecture does not support hugetlb CMA, hugetlb_cma_reserve() only warns and returns, but leaves hugetlb_cma_size as set by the command line. Consequently, we skip the boot-time allocation of gigantic huge pages, which matters on architectures where gigantic huge pages are allocated at boot, like powerpc with the hash MMU in an LPAR, where the firmware provides 16G pages. Further, we disable demotion of small huge pages and don't clear hugetlb_cma_only, so gigantic huge pages cannot be allocated at all. This only affects architectures with gigantic huge pages but without hugetlb CMA support, such as sparc64, sh, or powerpc with the hash MMU in an LPAR. The fix is trivial, so let's just reset hugetlb_cma_size like we do on the other paths that don't reserve anything. This has low urgency, as it requires passing hugetlb_cma= on one of these architectures. No need to CC stable. Fixes: dbda8feadfa4 ("mm/hugetlb: avoid hardcoding while checking if cma is enabled") Reported-by: Sashiko Signed-off-by: David Hildenbrand (Arm) --- mm/hugetlb_cma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/hugetlb_cma.c b/mm/hugetlb_cma.c index 3e5a30571524a..0a63197a9fc9c 100644 --- a/mm/hugetlb_cma.c +++ b/mm/hugetlb_cma.c @@ -249,6 +249,7 @@ void __init hugetlb_cma_reserve(void) order = arch_hugetlb_cma_order(); if (!order) { pr_warn("hugetlb_cma: the option isn't supported by current arch\n"); + hugetlb_cma_size = 0; return; } -- 2.56.1