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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF108C02182 for ; Thu, 23 Jan 2025 03:30:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2754D280004; Wed, 22 Jan 2025 22:30:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 22516280002; Wed, 22 Jan 2025 22:30:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C5F6280004; Wed, 22 Jan 2025 22:30:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E3750280002 for ; Wed, 22 Jan 2025 22:30:32 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2D61480B30 for ; Thu, 23 Jan 2025 03:30:32 +0000 (UTC) X-FDA: 83037289104.14.B0116CC Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf19.hostedemail.com (Postfix) with ESMTP id E59201A0005 for ; Thu, 23 Jan 2025 03:30:29 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=skBEgtL1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf19.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=1737603030; a=rsa-sha256; cv=none; b=UegKadvk2LJaB8GUlOgVCUiCKk8sfQtfKCUhdOuqqN/wqn5jRzx78qDDKS9IJK5QsY86fg 3X0YFM9lOEFNYqqqE1rDZVdn5q6SfB1sDZJh529H4ZaNYe3hZWGL3j8uvGsPRaWk6CRqGT 91V+89S1dUNPdjcqHv7sLlPktCaT8yY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=skBEgtL1; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf19.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=1737603030; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/Gg28fZ6XTo4bzoa5SJH279/YT+vQs51tNDlVTdUiaQ=; b=ZCxF3PlE8hofEmdtLKiZWYnzlgvpq/KaZMPirR8HhPwMIPCQ2EQcRjsnO+bWok/17tOpvD cre5Ou/T59ErU7yUDcAzUymQBhdufmPYZ8dphMJgFfyKlrmvdVyT1vG9CNDi8pXl+pDTx9 ZdG6XopnZ5jbLLSnUxgxxQ4951RdfWQ= Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50N2mqbB016790; Thu, 23 Jan 2025 03:30:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=/Gg28f Z6XTo4bzoa5SJH279/YT+vQs51tNDlVTdUiaQ=; b=skBEgtL1wwVl3bfROv/mc6 rqEp4D4shwNI9OE2/7gHzYgCfcBKihw4fkAwunTeAQ4z0pSi/jOr7NgyMd80+OvK W5ATEFCjdOfZ7nFOUQEDnSes2PK/brxsQAdsAvGBYEeYN4GF8YA7tVdyZMJq7Drh USwapeTTMG32ukzmQxr35oJF5mBjCtP/3LfhXEORJaK8M8tksye3ak4aXNil1ouG lPkV+WO7UKxPRaDINJWyU4SVREI3Zpt2nwllCNrbu45W9OdAPrhNqYkuBVuqu2Ri JMwW0XuW4Ilw69FwoBbwiyi5+FrvPUGoxQQ01ZGizTfoQnyjZQ9X11pZ0YqekOyQ == Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 44b3gttqys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jan 2025 03:30:18 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50MNkiim021080; Thu, 23 Jan 2025 03:30:17 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 448sb1k7v9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jan 2025 03:30:17 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50N3UE4I34996722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jan 2025 03:30:14 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20DCE2004B; Thu, 23 Jan 2025 03:30:14 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27CE620040; Thu, 23 Jan 2025 03:30:11 +0000 (GMT) Received: from [9.109.204.94] (unknown [9.109.204.94]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jan 2025 03:30:10 +0000 (GMT) Message-ID: Date: Thu, 23 Jan 2025 09:00:10 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/hugetlb: bring gigantic page allocation under hugepages_supported() To: Gerald Schaefer Cc: akpm@linux-foundation.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Heiko Carstens , Vasily Gorbik , Muchun Song , Madhavan Srinivasan , Michael Ellerman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org References: <20250121150419.1342794-1-sourabhjain@linux.ibm.com> <20250122150613.28a92438@thinkpad-T15> Content-Language: en-US From: Sourabh Jain In-Reply-To: <20250122150613.28a92438@thinkpad-T15> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: w2m3_3a-QB9cdFcKEir-4B9cCAZ8Nu9t X-Proofpoint-GUID: w2m3_3a-QB9cdFcKEir-4B9cCAZ8Nu9t 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-23_01,2025-01-22_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 suspectscore=0 bulkscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 mlxlogscore=828 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501230024 X-Rspam-User: X-Rspamd-Queue-Id: E59201A0005 X-Rspamd-Server: rspam10 X-Stat-Signature: prwasgnerzomim1ceybke9b89ciwiam8 X-HE-Tag: 1737603029-393934 X-HE-Meta: U2FsdGV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dV7TbrsaVcrcpNReLnfdXoFMD4qSyZmRH2FOMHsxLbHRFrsDOl4675Y2qJueqi94eH3K3apgX9KQlrKcNAXcg3ILW78jfFXXbn1fz4wlcWO4Oai+T3LOhbXPlwfQaxLvnAXBHF5sosrl9jEgXIFLrPNmyJ3KE4VUEteWdNOzu9TvzvoTu3xMHWKgGQVh8er54yYUSmWVvDIBrWcdovh0Hu5jq2MeqLO7ZjR0gXHK7tTgutrMpiqJ9ymbUgWQqUfeSJWbk5dvMTnQhM3RaDp1SOa8FHoOQMWrj2iQmp66wbZ38WY5sYFxIwLjePLVhqEqc3agQmDCCojEAn5UejCanLKY1STnmC7DTYOLJedQmtRFPNC+pAtSbtDSdWMC7Vu0m8HyxCmtdhugOxq918f1+EccJqkzk93j0xLEpbalRgj3jfgtfErg1lshQQM/zyQ4oKn7KioLiS0CvwDDGnC8RcAxKawKhSV1hECdpefxpBiyqMQ= 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: Hello Gerald, On 22/01/25 19:36, Gerald Schaefer wrote: > On Tue, 21 Jan 2025 20:34:19 +0530 > Sourabh Jain wrote: > >> 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 >> Cc: Ingo Molnar >> Cc: Borislav Petkov >> Cc: Heiko Carstens >> Cc: Vasily Gorbik >> Cc: Muchun Song >> Cc: Madhavan Srinivasan >> Cc: Michael Ellerman >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Cc: linuxppc-dev@lists.ozlabs.org >> Signed-off-by: Sourabh Jain >> --- >> >> 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(). > For s390, hugepages_supported() checks EDAT1 machine flag, which is > initialized long before any initcalls. So it is safe to be called > here. Thanks for the info. > > My common code hugetlb skills got a little rusty, but shouldn't > arch_hugetlb_valid_size() already prevent getting here for gigantic > hugepages, in case they are not supported? And could you not use > that for your purpose? Yes, handling this in arch_hugetlb_valid_size is even better. That way, we can avoid initializing data structures to hold hstate, which is not required anyway. Thanks for the review and suggestion. I will handle this in the architecture-specific code. - Sourabh Jain