Message ID | 20250121150419.1342794-1-sourabhjain@linux.ibm.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 69A4CC02182 for <linux-mm@archiver.kernel.org>; Tue, 21 Jan 2025 15:05:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6486A6B007B; Tue, 21 Jan 2025 10:05:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F9036B0082; Tue, 21 Jan 2025 10:05:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49A376B0083; Tue, 21 Jan 2025 10:05:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 280A56B007B for <linux-mm@kvack.org>; Tue, 21 Jan 2025 10:05:00 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C588D160C68 for <linux-mm@kvack.org>; Tue, 21 Jan 2025 15:04:59 +0000 (UTC) X-FDA: 83031781518.12.2E2F1A6 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf25.hostedemail.com (Postfix) with ESMTP id A1A0CA001C for <linux-mm@kvack.org>; Tue, 21 Jan 2025 15:04:57 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=mthAQY4+; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf25.hostedemail.com: domain of sourabhjain@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=sourabhjain@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737471897; a=rsa-sha256; cv=none; b=GlwZopQw1P9/2VN9OEO8fMss0bcP4CJw5ILFKKBHA/PpxpWccMzyuKYJrEtpWPFMdNgben yvvAKx1ZT9dpv2sRAbYHHD8BKmQvxXnAQ1lEjmL6LsO/gcupTUenxp502fHxW/XlYFbrMl nej26ka026lbn0Lfgr3m3WP+8pAosA4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=mthAQY4+; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf25.hostedemail.com: domain of sourabhjain@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=sourabhjain@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737471897; 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:dkim-signature; bh=0WHdHb6F/UdUkGp/zgeU43qqnF+ZgyA8tTBJiib4Y5E=; b=ObCgIQUVQZHmGRSRCKARLPfjMlakuYbyq6VGYnir0gIyIZzCjFqwgQ5cdoRu1LNPhb4y9Y V7eqZitKKimm9M8adD5bSj1TiU8YP3mpibd1Hg7PBiKY0qgpqDHU2Qj5IgMd90Ju+RkHQe rhYTS63X321YFbO5H5qmK03xYu5Sk5E= Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50LDJKEi003049; Tue, 21 Jan 2025 15:04:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=0WHdHb6F/UdUkGp/zgeU43qqnF+ZgyA8tTBJiib4Y 5E=; b=mthAQY4+1lxPsoCGSEykXMvMfgwTCbndnXV4EVtNUmCCmdHnu8+BEaWoY b4fXI9DiQ7hGHPq+iA5uzTvarWQ1Bsb6L2yzV0cwsGlCGEBC/+4tDoCv0g0Vs6HF SMbr6FOTxCgDSMgzZVYqxpCw0fAsKZaWuo9yGTkln5jAoU74opxFxkCjVSbUP8zX f0sPiJo/0t/8WRMM0XXq67tnkPaMGe+5f8tMCwBK7z8xdmWhlPebOHMS3RxMWii/ YuDTcvpefjkf+Zi3kq/Frnc2Rj292PD3huqUO2KXoqYYdye893+qJQchmoKQpc6M KP7y5gwuZjg1QtPyznk3L95L4VPTQ== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 44a2dyb80r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jan 2025 15:04:42 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50LD9Z8b019223; Tue, 21 Jan 2025 15:04:41 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 448pmsbugn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jan 2025 15:04:41 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50LF4aJq57672080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jan 2025 15:04:37 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFFF820043; Tue, 21 Jan 2025 15:04:36 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F0CF20040; Tue, 21 Jan 2025 15:04:33 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.54.128]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 21 Jan 2025 15:04:32 +0000 (GMT) From: Sourabh Jain <sourabhjain@linux.ibm.com> To: akpm@linux-foundation.org Cc: Sourabh Jain <sourabhjain@linux.ibm.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Muchun Song <muchun.song@linux.dev>, Madhavan Srinivasan <maddy@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] mm/hugetlb: bring gigantic page allocation under hugepages_supported() Date: Tue, 21 Jan 2025 20:34:19 +0530 Message-ID: <20250121150419.1342794-1-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: waNMvQVPCRQmQ47C0vVOdm-GXBHxCt8K X-Proofpoint-ORIG-GUID: waNMvQVPCRQmQ47C0vVOdm-GXBHxCt8K X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_06,2025-01-21_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1011 mlxscore=0 phishscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 adultscore=0 mlxlogscore=921 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501210122 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A1A0CA001C X-Stat-Signature: nxkqmqju3mbgknw1cnqcirt6qbgpwscm X-Rspam-User: X-HE-Tag: 1737471897-685246 X-HE-Meta: U2FsdGVkX1/myiwg3FZYsWfoOnUeZOtMPN8ucgUq5d/9GXrFfTrRPT4FMYAvzN6/lrAt/OBWJKGmauQC2bYRTgOD/MUpJEUN+zuTKKWAr3WtSxMHZQAqNHbDCnVb30i8DeP9vOSosH3aG7P/fbaatlnmpabSXq3qPVp3xOotH32RsoKP6OuPoCXiSHjYcKGVySXraZrMBax9JMudjnDvXPUe/VWXoC1c+/Xjh26FmJ7kUj6QKvOcZWWoq35kZ6nXOdlciXr33PKBrsSXJ7pWuMQSXrOCWoI6YONadCd0+Bxn1JJ4xj0xIexCS0W3bU5oL9CWeg6SNfYGaJyeKtE2h9aOazTXrElOVQ7crYMBPszE16h40GfDG4Ichg+aSb2iNUxOCWE7x3+DeVOGYZxRZZ9e7n3rfCljlzIx7HTmtodqlt75bPL7C/RzS8D6JBWOBX2VcvHZsOgYr/OByULhd0XhjjvCsZmTlM24WeqmJ91eMAeOOqX6eoZIP7KngHmtVL3iZ+1gD9meLDtSjUfjr9YDqi1ERjdpDubJqwuo/3K65T4GVByz2RPOpA5wxaVoD9HkkXMNDvoa1b9DT5QX6llKiICC01dsooclbHhAFxGgFfw2stofstNlARjGFcycVKSKmNaCRC9cznwbdjVdno8DY0xbTV9p//vgetAu14/rrk2u8r9ld1ptNWPnatEqgy49CgKrsMHOuewBeDkmofEV9Fd1AvITB6KF+NsGOiLkCwJ/pjlegLCzFgMpwIRwMKjcWLeD6CYK5zYR475wrhKTr7a1o+i3eblIYsf2dqda9mM+hU7LJ1YQKPpeS+4YHSR23mq8G5JSmA0S/jpIOvBG5yaHM3wfg3kgmlChhR1Bru5jpwiA7xhIAzve48gHEMp+5QHwbPYTSdNry39UkPhybkjvcuAM1pMACb/vvC5vJMXXPYjO+0asYr8R2XxlJo4o4enx74kht9sL7cZ aWPatG9G xnL7Kum/Un/uibnQ7C4qw48RlY0ZeSuzTwyjubWMuDjMbyc30UfKEnaGE7Mvia1zhl0wi/rsQi9OkundvC1UEY8LSrULsF441OeTBMH88o73TDZgOgvQJmrVOAoHhIpWNbXn8vMSaXnhe6K26I96JvU0ePoBXVU7jZZR+llQy7GLXgvIcPZccEYYD5B14O7BbYX1NFxuOtzhMioMS+ypRgQXsSnEgKwZZAmEXdUg4zU6eccOK4kVSNiEleSDpJu13q4kCVK2aPyap7GErrLz5QeTINKu1Azq/VXunIIV6pXlmU9qN204YB1hVqtH0ASqA7OisUgMIL1+R8B+uIlF3NCg2BSTia7m4KA6hRdx9Lucuw0Jl1fMFx4rQ0n19ltz4JwfcWZxTfeabQ8ujb+BFIS8ic4ZsfRHG38YvNaVlBa2gDRhjrARjT016/UUrTGZpBaRJcepoEoQ/19ft6JM3M5dZVwOxfZtczcdXArsBilF4K4pZQJOIn0kQpICP9/H45jbb36KhTXQrdLyX9h33G8kfYEHlhtiZw7Ss 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/hugetlb: bring gigantic page allocation under hugepages_supported()
|
expand
|
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cec4b121193f..48b42b8d26b4 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4629,7 +4629,7 @@ static int __init hugepages_setup(char *s) * But we need to allocate gigantic hstates here early to still * use the bootmem allocator. */ - if (hugetlb_max_hstate && hstate_is_gigantic(parsed_hstate)) + if (hugetlb_max_hstate && hstate_is_gigantic(parsed_hstate) && hugepages_supported()) hugetlb_hstate_alloc_pages(parsed_hstate); last_mhp = mhp;
Despite having kernel arguments to enable gigantic hugepages, this provides a way for the architecture to disable gigantic hugepages on the fly, similar to what we do for hugepages. Components like fadump (PowerPC-specific) need this functionality to disable gigantic hugepages when the kernel is booted solely to collect the kernel core dump. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Muchun Song <muchun.song@linux.dev> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com> --- To evaluate the impact of this change on architectures other than PowerPC, I did the following analysis: For architectures where hugepages_supported() is not redefined, it depends on HPAGE_SHIFT, which is found to be a constant. It is mostly initialized to PMD_SHIFT. Architecture : HPAGE_SHIFT initialized with ARC: PMD_SHIFT (constant) ARM: PMD_SHIFT (constant) ARM64: PMD_SHIFT (constant) Hexagon: 22 (constant) LoongArch: (PAGE_SHIFT + PAGE_SHIFT - 3) (appears to be constant) MIPS: (PAGE_SHIFT + PAGE_SHIFT - 3) (appears to be constant) PARISC: PMD_SHIFT (appears to be constant) RISC-V: PMD_SHIFT (constant) SH: 16 | 18 | 20 | 22 | 26 (constant) SPARC: 23 (constant) So seems like this change shouldn't have any impact on above architectures. On the S390 and X86 architectures, hugepages_supported() is redefined, and I am uncertain at what point it is safe to call hugepages_supported(). --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)