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 CAC8FC02182 for ; Thu, 23 Jan 2025 09:41:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 312076B007B; Thu, 23 Jan 2025 04:41:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29A326B0082; Thu, 23 Jan 2025 04:41:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 114636B0083; Thu, 23 Jan 2025 04:41:05 -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 DCFD16B007B for ; Thu, 23 Jan 2025 04:41:04 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9E2431A0DA7 for ; Thu, 23 Jan 2025 09:41:04 +0000 (UTC) X-FDA: 83038222848.02.C9DDC38 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf20.hostedemail.com (Postfix) with ESMTP id 4124E1C0006 for ; Thu, 23 Jan 2025 09:41:02 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=TR8YmfOq; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf20.hostedemail.com: domain of hbathini@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=hbathini@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737625262; a=rsa-sha256; cv=none; b=ulH3NGoZm8m7PJXJ7y81Msbw1gJER4b4Br1/Jb9Pzelzy1YQP51TM+Nrj3J2eWzNdMKvJz R3FlNWXMsqacfFHKjh/cANB5tKFq0+57cuD5J6acCorFEwPxmY2JFDKWC0NgqelNmgqfCH GyyDmm8Q9RFLsxZkdVWhirdirksTWVw= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=TR8YmfOq; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf20.hostedemail.com: domain of hbathini@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=hbathini@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737625262; 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=BkAMvBka9lz7qA1vfG9q4Q/Fh4/ZUTAlk7oKlinox1I=; b=mRM30J64TLkMeSF1gzqb/TvVNC1BZ6sbz+UvWHjLGi9AM8M1Xm07WtR3buTU5GLs5/hl0l IyQP6aDGD/eVp/nZ8MQ2uJw9vlNEaCD/+l3z8yQc/Y5TKZf1PunKjJIgL5WUL/OpP3Tchn jddVz6lFPNfF87+3hyAstJ57DfZ1UlQ= Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50N5O2qT026487; Thu, 23 Jan 2025 09:40:47 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=BkAMvB ka9lz7qA1vfG9q4Q/Fh4/ZUTAlk7oKlinox1I=; b=TR8YmfOqwnRiuSaQD5JCC8 iRhfBLl/6sDvkevMOl/a3M1jucZ9tRLXWb9pVFZ44CHcBGP3L+9stn+N1IL2ZG7t F+7IVbplzeIbftdPK6Iz3cRkMqW5ZP7uZfIuibww+rEUExGXmK1XDQnLGz0Fn/xZ uzAcjDP8vy5f2UyphRlln5O63OcHsI8Ygy9BdIw1jCrnI8BbPEUZ11Ud0uUm0zgZ aPOimWQbY0uk0FeWqK1iCZebJ4zvaejxIwuWOVFihr8DKNGpcgjJNH1bSTfZpQtc pKLYFna5GtxFEduzAFb91D6EoE0cJECqMvypjkvg7Fd113VG5R8Z+PVShw5cBh6A == Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 44bfk7s3r9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jan 2025 09:40:47 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50N5rm19024241; Thu, 23 Jan 2025 09:40:46 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 448q0yd0qg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Jan 2025 09:40:46 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50N9eg7F32768342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 23 Jan 2025 09:40:42 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 647D02004B; Thu, 23 Jan 2025 09:40:42 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3BC7D20043; Thu, 23 Jan 2025 09:40:39 +0000 (GMT) Received: from [9.203.114.244] (unknown [9.203.114.244]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 23 Jan 2025 09:40:39 +0000 (GMT) Message-ID: <02f48a21-2dc6-457d-b8a5-bafb9dbb64c2@linux.ibm.com> Date: Thu, 23 Jan 2025 15:10:37 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/hugetlb: bring gigantic page allocation under hugepages_supported() To: Sourabh Jain , 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: Hari Bathini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: AO_UvKkwcxoYsdky9iPtWgvMAHp3_3YT X-Proofpoint-ORIG-GUID: AO_UvKkwcxoYsdky9iPtWgvMAHp3_3YT 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_04,2025-01-22_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=938 adultscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501230072 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4124E1C0006 X-Stat-Signature: 7cjzsu5w54q6qyiw95axcyoitydd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qic43f+cVlc7qF1dkEJjYldR+CKiy4tkG2sbOUnCqui/w6/GL6P1pbu3dVmWf0vjP2Cy9rwoTS9eZJZ592IFMGtB6e/6C/bWLM0s3yRBDzlo2F7kpVpGBymJoT2CZ5taLgKU2B6E13ZjeywBZnEaIfhMTmpnJZAlcvJIblwUJjHHpNlN0zOs8AireR9ZtYP9/ecWGmmxFe4R6ouwndpowDeapr+erSNsBgi4WG/3Te+9bfLE1DOa/qLIdCcEZGUV2sWzmadulthGQrGqwGnwRJPzFit586XwmwVHZMDF+IpuRwtCVRGKgz9T+JOe4jMlT7DE3cQDL3bDqAlKOMVBSMzXl0O4mHBslp+qJ8jEqbErLf1s0T8ahfpx7mlD77m6b84MEDOD/rPPXhk5xPiH2o0Z+DhIhUlZ48PC1DGlA== 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: On 23/01/25 9:00 am, Sourabh Jain wrote: > 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. Yeah, adding a check for hugetlb_disabled in arch_hugetlb_valid_size() should take care of things? - Hari