From patchwork Mon Sep 25 23:48:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13398575 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 CB649E81806 for ; Mon, 25 Sep 2023 23:49:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 702D78D0050; Mon, 25 Sep 2023 19:49:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B1998D0007; Mon, 25 Sep 2023 19:49:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F0A48D0050; Mon, 25 Sep 2023 19:49:23 -0400 (EDT) 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 2E5328D0007 for ; Mon, 25 Sep 2023 19:49:23 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 61B4912083E for ; Mon, 25 Sep 2023 23:49:22 +0000 (UTC) X-FDA: 81276763764.03.DAF7FDD Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 1B3E320020 for ; Mon, 25 Sep 2023 23:49:18 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=xAPfYYE0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VLbGU6nW; dmarc=pass (policy=none) header.from=oracle.com; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:dns request to arcselector9901._domainkey.microsoft.com failed: no records with this name}"); spf=pass (imf13.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695685759; 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=/NHM7VaeEfDia6EH7j8Eb5iVUqEnbrMv6N5cLhl9+Pw=; b=o0KroIS/wwd1VDjWECDWOlH39rtPAXC5mXlexG5BE6xJ8rJ+Uqz/8iAoN8po2rzVr9PMv0 9q5Ev3ip61wOclpBua21D05verrwdqsNMcnYwTOFIa7v64AYSusYh4eb82boMfLe4HuwWF 5rBV/VqBM5gSUhwm61BL3cqt6pqIyGM= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=xAPfYYE0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VLbGU6nW; dmarc=pass (policy=none) header.from=oracle.com; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:dns request to arcselector9901._domainkey.microsoft.com failed: no records with this name}"); spf=pass (imf13.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1695685759; a=rsa-sha256; cv=fail; b=oPV0d126Dv2Pr/ldFmISZU3k9Tl6WawMXgTvC0JqClZw/dkol+7t0xEilMBAjEEVmpuu4N 9TkX0LQPbYdhzVD3U2SpQMcBENBXSoAzS4RqxVGpvOVMrc3f3XOiYclLkvGsnCYyTRBSnJ bJRFWC42py+YzTUaBy3x5agdanKRZpc= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38PNDtbL021928; Mon, 25 Sep 2023 23:48:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=/NHM7VaeEfDia6EH7j8Eb5iVUqEnbrMv6N5cLhl9+Pw=; b=xAPfYYE00r4rCaYekqqAULdNWuCuncbrI00jFywUSOr7Y1fdTpO2WvbIDx6S6HjLi8fx KpRiQGSSqieVH5K6aE87x6cRKOEfUm0pBTIvAXWOS29fOiB5e5avOMhKt4pGzeZJIxBZ 4D1CzCQl7rgjY2Ow/ON4LwYltLq0y4b9F0t2+B5dgyI39JGyTiM/npDDXc6Alr1Ml8QS V1yZnCBD0erL3CRd3Vf8VVaav6MX10kyPUDatlwqcUU6tH7gftTRaAO7SlvMa5oR3PZ2 xxyMeV0DIrBzDXK0l/FIeUBLcmrpQugYCikWb5YhtDPCNAYzRUfWj97eJ72+bMxEkc4t rw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9qmud5pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Sep 2023 23:48:53 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38PN0WIq039366; Mon, 25 Sep 2023 23:48:53 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2044.outbound.protection.outlook.com [104.47.57.44]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfbbda5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Sep 2023 23:48:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lSJ1ZOK5202HkesphdzaDSMBa1YutXu+Rk/xGQV7tua4cpn3w+3WPWeD9K4hXa5UOBdh7kCIwnI5RPYKyeKJJuPmPaDR/wHjAi0FbufPYnTgwv4G9UhGl0OcfHZG81ZC8nOq9KRfVDkwMfWGkkdPkhLlt9h9C+odKS7H4K6TR6x9cZ7kx66aydnAM+/STDtpJtNSBJXD2VWItRTNyyfA460NJYjStcbChLgryqXB99hUftGFZSWEx3xAhLNgp2Cfyg2X2/zbEcuYb5bh82QmesA5m0cGWElNJI9c78VOUmSc3BQ48g4CRgwuOMl+h2borWRpv59BW2CE3j/AcZ8n/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/NHM7VaeEfDia6EH7j8Eb5iVUqEnbrMv6N5cLhl9+Pw=; b=asJet6LOSePIDIOUgN8i030unH140m3C1PGB6W6hWX4aQHL5aXohfdVVp+1AI/FYYRraNdvuBKOEoK6+XRFBShZKN3667ae/fWtOX2fcESNePK9B2y+ajrtAeEDTUm471mjV8U7jZJzAxNrwDuKGZKCyoKQbkIoqp8u2hc8KRyvur/EKf6UBNSjSr4PZPUOAh1ItDQqUw7eMiZTIVUqw13uaSlt51p7XfxeBLLQQoq3ruTTxtEX8KiTErq01Ra5Jln10dHlfFVhDLhbU4Hgdn97jrqbfQP2Nnriq2nPm65tiKv09gt2HVDQFmGzZxO4TMBr4yinH/tcpwCR5CbcPkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/NHM7VaeEfDia6EH7j8Eb5iVUqEnbrMv6N5cLhl9+Pw=; b=VLbGU6nWnov2i7knhLNQpKtLdOTC0wwza5UdQUbu7cpgNoXx/RvMv0rH7kizyf7ZkkORP1F3CPyo8gWd7G6Wdj6ZJ4KJqGb3o6V0NPDseIXXtLswKtBFtFbwWuAaNB2rhBpPgqfzL/wblkX9a7qFBqlsAyfsVjRo50RLEOz/sVM= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by SN4PR10MB5653.namprd10.prod.outlook.com (2603:10b6:806:20c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.30; Mon, 25 Sep 2023 23:48:50 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::c621:12ca:ba40:9054]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::c621:12ca:ba40:9054%5]) with mapi id 15.20.6813.027; Mon, 25 Sep 2023 23:48:50 +0000 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Muchun Song , Joao Martins , Oscar Salvador , David Hildenbrand , Miaohe Lin , David Rientjes , Anshuman Khandual , Naoya Horiguchi , Barry Song <21cnbao@gmail.com>, Michal Hocko , Matthew Wilcox , Xiongchun Duan , Andrew Morton , Mike Kravetz Subject: [PATCH v6 2/8] hugetlb: restructure pool allocations Date: Mon, 25 Sep 2023 16:48:30 -0700 Message-ID: <20230925234837.86786-3-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925234837.86786-1-mike.kravetz@oracle.com> References: <20230925234837.86786-1-mike.kravetz@oracle.com> X-ClientProxiedBy: MW4PR03CA0170.namprd03.prod.outlook.com (2603:10b6:303:8d::25) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|SN4PR10MB5653:EE_ X-MS-Office365-Filtering-Correlation-Id: 42372051-d28d-4f04-e0a5-08dbbe21f78a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b4BHOX2j42xs9dyNUUfN0Bcyvhmo0HIWCHWB/WNMSVag7NcFTFk++/ClKGhFapOq83liKTe0Qym81Oyp/mIr/zZq7b7FHxVAIfPu6r12jTVvgk4Fw9+3b2xNy1nGyT2O2NxTVPmtPyysJDYGO3EVHMkFb67DqDDUCHspSjpp5TA+BGRZxT0bikwUtmn7rzMWRTb8JgLn1DkMWZweryOoc2o6IDuXBR23uzaD0IBSKpkwblDLW7A1+DNuE933MMSxVO8e+LOpjjqbdQ79dyKjNoILTOqXVtUzyIUpcJcC10uO12X6jSvvDAW6pv/QQirjrgkUw46NrlgqKQylp+vtiI7J5WWrFg+HcXQENme4gj+F5hG28FP8bIhUlCVDXCUHKxGO8lZ0182DbvnF71PuNPoqTIGDlOIt9nvcKN8pOt8KFmv454uLtqoyubE42/F/DuOl4d0Xx4D309zpOoQCB0LoYE5J2pCsCrj8v8yY2gA6fSC8ah+vcCqyRk28hHOc0LFWPdDoqmpPfQYtY5aHKr8hD0VURPOPnwZ59BiLSxQ0QZVxlGqEsV4EYXJGNsU+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(39860400002)(396003)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(1800799009)(86362001)(2616005)(2906002)(30864003)(7416002)(36756003)(26005)(107886003)(44832011)(1076003)(5660300002)(83380400001)(4326008)(6512007)(6486002)(6506007)(8936002)(6666004)(8676002)(478600001)(38100700002)(41300700001)(316002)(54906003)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NN7MG4Du/x5LGF3hnAYTLETFlUaoEU8yZxQiaS1vGIATZ+Wnt667jpu0r5WJDbbUNHpjLwjdlLmYQyI+dHgJ1R5neidzbHYZFicRr5G/pQUVDsyDEOSwgJZvuqVWwWEYbru87RT8G9zQ+X7yPbbv7jeLMbWxHuSKeH1Vf49hvk51fxZ+5JomWBiyaaQxdWUHp73DuLaZF4AFJ4+KB2kBKGPHjTwRYy0u4s9CSAac37Ib2vsqoJah/Vos72E0T/O3fXvqNdyeD0mg3G2hwa/1QwI/T/Wfzuro9MBvArGC4C1QTAF+jPCudzkLzvOUJUYMl+zP3n0KD/BRCnQp/Uc1e9634PMMZdN/7kxaY8fnhizW8LipK+Zx3a+cJxxjvn18vF6BIsT0+hPEAeHiEQhmo6Z+mcAkx1320u2msHGyM6U1kijFDTkc4XnVdcvOL9FNBHD5AU3oehix2duRlZ2pMpbTw78+smjJ1Suq0wJNg2KeEbOyRnnXnZ2RHDdQ9lKTh3NNdZoHmYdAvTY0QdKJI2H6/KnMbjUDnhQigJryZ2xRDxHKCasAK2IJ6aXLxgTdl2uHUjlUFMfKe3MfKahIAC5SKeTs/VEt1OalzAxKsUPEpHffccoiq++29wBVbxN9xelwKhO30hhoCYtI8j/N0r3K4ixHFgi7QoLckGvFyqYpE2LI+WoWvELSVfHrisQm8Q7UwdkSWGBCnVGlkGf4KtJm5AaZcH26FMjkHkD582r5vSsT2TLXAnQcGU50ZHL7miVLL4chyYlSUtX/Emk5JORnbLBJMpFRsGlnkKcLinleNEj1ArowgFyQZxyhdzNGiArkEzG8SothzJgcJhUnsVdxQRhzX0KV61f8q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cubS5emKwUm2FR9ldT+wWDbTdLapm/cPX8fR0JlyQRe9apEt9dOjnttanm86YcZTbrijX5gNkJ38QqJM/jplvdQ0y7nEndMl2VzAAx6QDfIbVw2fQCSQegxELf4n6e6FJDmtd7QdAPN7QoAl6yJPme6XXRwCoMOqCFpDIChwfcIPkJ98ztUAmjkRt1aKEybxgWoP+bzFoS1/TIO1fNIdRmHcxkZGeoV049Nkk5mtxJKl1ZLJwBe4hqvtuUm5ouNepZkjIIElQPWHqRcHP1LhOWTZH/kFhje7JG8W1hNk5owkOqWSunYLczbN5bHf2+5xVSMWdHr6aaiXwOM2pv9o5vnHQ+2xUJ6IKSzyf8O6/6UkRzhp0QcTJ21KllrBNJ+6aGhRjVGOQRcHnXAGod8OsWw1Cw9OBUW/6gDJT/zbzNXf7OMtI+FL/fJk2j0yOlyPgZ6HSyPZ9N87gf7m7Q0lKI8CfoW+gS+nRJX0+Ed86ei78DeRP8llmobCSYAI9hJsCZK9d8W6rW6UQ+894c8zvJJ3Z3mryQOb/XHl5nMg02CWAOJ5vZqqCZxVvdtiRZoRm4Vg1vC9V4jyVw85FSaRoXmhUFKbo8nmUXdlij1zR4fAbKL/+6ERP3qEuy5DvVijQUj3r7K0W8nLPg93P4lSDPhFfuwgoOp5gJBdain88ERzD01zinrXoZs1p/sielUQ6V/Ps3iRAyqRiXbdRI7k2Kjui4ZcxWKjL66X5ZrDowmisuqeVUN26IndgWnInS5GKq55/CJrZdY2Q6d54fNn/Cg39IkpFVidgSfpGav0LcJOg6JUTUp9JPcOM2J9ILGMCKoBTx5mfmcQOmNSkyaXb5zy6LlX48G0pvGwv63X9jskm3/nJ1yMw+NwIkbUI1ru X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42372051-d28d-4f04-e0a5-08dbbe21f78a X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2023 23:48:50.0379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b/8KoQzpAwDS/iCKc8FhinE0n5OGXy6bxIfADs1CqGopF/FCGD+uS8/eniCMX+QDa4CY5dEJHw2rPBXx6YTabA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR10MB5653 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-25_18,2023-09-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309250185 X-Proofpoint-GUID: EU_Vg7tC1sN9L_Gf4iYJuU3zZEyHGk9h X-Proofpoint-ORIG-GUID: EU_Vg7tC1sN9L_Gf4iYJuU3zZEyHGk9h X-Rspamd-Queue-Id: 1B3E320020 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: gknpkqiqi5p3udrd4asuiiymj6inekty X-HE-Tag: 1695685758-564442 X-HE-Meta: U2FsdGVkX1+i2/oHQX4VGzsc6M/R3yzM7ASHCuC5UNVetWAexkWXK1EO2ZLiX39Df4tvazgfFVTC16ZMLE3fMteI2TLmqhHPcX0tW7V9WuL5sAg0m3llVFmAzw3i4BnVOjMvjepNea2eF4MH2yhn0aLs1oaOvARt1YxH2bKeQLwAMYk/AaVi5e69xe5KaGhfWDPjy+CjuWZKYmy27oWzUZLGM/IzIbfxB/uL/O73Qrcw+UB72gSHnM3Y1dn2RxnKaL2FzYyOsbSISB2Mg+BNre/KErDo6n0rwluCCGDa0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sDSAuclMpfuAzGVDbFdhkHLooCQnaX/GZjnppgxFt2xN73SJx078ykkiR2cVRM6eYrxFhCI49QXKJU5xDq/m9ZdI9BbIVy5tE5rcar/Nx00Q+1jrUY9Ncbh002vBiHMghb1kt9QnMe2DrbJHjhL5BrYgqwjJHdg4J7zIgFurwodrjC5sO2xHlkUHTOVK+ioSmDbTaxgVbqSpkuSaRGE= 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: Allocation of a hugetlb page for the hugetlb pool is done by the routine alloc_pool_huge_page. This routine will allocate contiguous pages from a low level allocator, prep the pages for usage as a hugetlb page and then add the resulting hugetlb page to the pool. In the 'prep' stage, optional vmemmap optimization is done. For performance reasons we want to perform vmemmap optimization on multiple hugetlb pages at once. To do this, restructure the hugetlb pool allocation code such that vmemmap optimization can be isolated and later batched. The code to allocate hugetlb pages from bootmem was also modified to allow batching. No functional changes, only code restructure. Signed-off-by: Mike Kravetz Reviewed-by: Muchun Song Signed-off-by: Usama Arif Signed-off-by: Andrew Morton --- mm/hugetlb.c | 179 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 140 insertions(+), 39 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 47159b9de633..64f50f3844fc 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1970,16 +1970,21 @@ static void __prep_account_new_huge_page(struct hstate *h, int nid) h->nr_huge_pages_node[nid]++; } -static void __prep_new_hugetlb_folio(struct hstate *h, struct folio *folio) +static void init_new_hugetlb_folio(struct hstate *h, struct folio *folio) { folio_set_hugetlb(folio); - hugetlb_vmemmap_optimize(h, &folio->page); INIT_LIST_HEAD(&folio->lru); hugetlb_set_folio_subpool(folio, NULL); set_hugetlb_cgroup(folio, NULL); set_hugetlb_cgroup_rsvd(folio, NULL); } +static void __prep_new_hugetlb_folio(struct hstate *h, struct folio *folio) +{ + init_new_hugetlb_folio(h, folio); + hugetlb_vmemmap_optimize(h, &folio->page); +} + static void prep_new_hugetlb_folio(struct hstate *h, struct folio *folio, int nid) { __prep_new_hugetlb_folio(h, folio); @@ -2190,16 +2195,9 @@ static struct folio *alloc_buddy_hugetlb_folio(struct hstate *h, return page_folio(page); } -/* - * Common helper to allocate a fresh hugetlb page. All specific allocators - * should use this function to get new hugetlb pages - * - * Note that returned page is 'frozen': ref count of head page and all tail - * pages is zero. - */ -static struct folio *alloc_fresh_hugetlb_folio(struct hstate *h, - gfp_t gfp_mask, int nid, nodemask_t *nmask, - nodemask_t *node_alloc_noretry) +static struct folio *__alloc_fresh_hugetlb_folio(struct hstate *h, + gfp_t gfp_mask, int nid, nodemask_t *nmask, + nodemask_t *node_alloc_noretry) { struct folio *folio; bool retry = false; @@ -2212,6 +2210,7 @@ static struct folio *alloc_fresh_hugetlb_folio(struct hstate *h, nid, nmask, node_alloc_noretry); if (!folio) return NULL; + if (hstate_is_gigantic(h)) { if (!prep_compound_gigantic_folio(folio, huge_page_order(h))) { /* @@ -2226,32 +2225,80 @@ static struct folio *alloc_fresh_hugetlb_folio(struct hstate *h, return NULL; } } - prep_new_hugetlb_folio(h, folio, folio_nid(folio)); return folio; } +static struct folio *only_alloc_fresh_hugetlb_folio(struct hstate *h, + gfp_t gfp_mask, int nid, nodemask_t *nmask, + nodemask_t *node_alloc_noretry) +{ + struct folio *folio; + + folio = __alloc_fresh_hugetlb_folio(h, gfp_mask, nid, nmask, + node_alloc_noretry); + if (folio) + init_new_hugetlb_folio(h, folio); + return folio; +} + /* - * Allocates a fresh page to the hugetlb allocator pool in the node interleaved - * manner. + * Common helper to allocate a fresh hugetlb page. All specific allocators + * should use this function to get new hugetlb pages + * + * Note that returned page is 'frozen': ref count of head page and all tail + * pages is zero. */ -static int alloc_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed, - nodemask_t *node_alloc_noretry) +static struct folio *alloc_fresh_hugetlb_folio(struct hstate *h, + gfp_t gfp_mask, int nid, nodemask_t *nmask, + nodemask_t *node_alloc_noretry) { struct folio *folio; - int nr_nodes, node; + + folio = __alloc_fresh_hugetlb_folio(h, gfp_mask, nid, nmask, + node_alloc_noretry); + if (!folio) + return NULL; + + prep_new_hugetlb_folio(h, folio, folio_nid(folio)); + return folio; +} + +static void prep_and_add_allocated_folios(struct hstate *h, + struct list_head *folio_list) +{ + struct folio *folio, *tmp_f; + + /* Add all new pool pages to free lists in one lock cycle */ + spin_lock_irq(&hugetlb_lock); + list_for_each_entry_safe(folio, tmp_f, folio_list, lru) { + __prep_account_new_huge_page(h, folio_nid(folio)); + enqueue_hugetlb_folio(h, folio); + } + spin_unlock_irq(&hugetlb_lock); +} + +/* + * Allocates a fresh hugetlb page in a node interleaved manner. The page + * will later be added to the appropriate hugetlb pool. + */ +static struct folio *alloc_pool_huge_folio(struct hstate *h, + nodemask_t *nodes_allowed, + nodemask_t *node_alloc_noretry) +{ gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; + int nr_nodes, node; for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { - folio = alloc_fresh_hugetlb_folio(h, gfp_mask, node, + struct folio *folio; + + folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, node, nodes_allowed, node_alloc_noretry); - if (folio) { - free_huge_folio(folio); /* free it into the hugepage allocator */ - return 1; - } + if (folio) + return folio; } - return 0; + return NULL; } /* @@ -3264,25 +3311,35 @@ static void __init hugetlb_folio_init_vmemmap(struct folio *folio, */ static void __init gather_bootmem_prealloc(void) { + LIST_HEAD(folio_list); struct huge_bootmem_page *m; + struct hstate *h, *prev_h = NULL; list_for_each_entry(m, &huge_boot_pages, list) { struct page *page = virt_to_page(m); struct folio *folio = (void *)page; - struct hstate *h = m->hstate; + + h = m->hstate; + /* + * It is possible to have multiple huge page sizes (hstates) + * in this list. If so, process each size separately. + */ + if (h != prev_h && prev_h != NULL) + prep_and_add_allocated_folios(prev_h, &folio_list); + prev_h = h; VM_BUG_ON(!hstate_is_gigantic(h)); WARN_ON(folio_ref_count(folio) != 1); hugetlb_folio_init_vmemmap(folio, h, HUGETLB_VMEMMAP_RESERVE_PAGES); - prep_new_hugetlb_folio(h, folio, folio_nid(folio)); + __prep_new_hugetlb_folio(h, folio); /* If HVO fails, initialize all tail struct pages */ if (!HPageVmemmapOptimized(&folio->page)) hugetlb_folio_init_tail_vmemmap(folio, HUGETLB_VMEMMAP_RESERVE_PAGES, pages_per_huge_page(h)); - free_huge_folio(folio); /* add to the hugepage allocator */ + list_add(&folio->lru, &folio_list); /* * We need to restore the 'stolen' pages to totalram_pages @@ -3292,6 +3349,8 @@ static void __init gather_bootmem_prealloc(void) adjust_managed_page_count(page, pages_per_huge_page(h)); cond_resched(); } + + prep_and_add_allocated_folios(h, &folio_list); } static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid) @@ -3325,9 +3384,22 @@ static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid) h->max_huge_pages_node[nid] = i; } +/* + * NOTE: this routine is called in different contexts for gigantic and + * non-gigantic pages. + * - For gigantic pages, this is called early in the boot process and + * pages are allocated from memblock allocated or something similar. + * Gigantic pages are actually added to pools later with the routine + * gather_bootmem_prealloc. + * - For non-gigantic pages, this is called later in the boot process after + * all of mm is up and functional. Pages are allocated from buddy and + * then added to hugetlb pools. + */ static void __init hugetlb_hstate_alloc_pages(struct hstate *h) { unsigned long i; + struct folio *folio; + LIST_HEAD(folio_list); nodemask_t *node_alloc_noretry; bool node_specific_alloc = false; @@ -3369,14 +3441,25 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h) for (i = 0; i < h->max_huge_pages; ++i) { if (hstate_is_gigantic(h)) { + /* + * gigantic pages not added to list as they are not + * added to pools now. + */ if (!alloc_bootmem_huge_page(h, NUMA_NO_NODE)) break; - } else if (!alloc_pool_huge_page(h, - &node_states[N_MEMORY], - node_alloc_noretry)) - break; + } else { + folio = alloc_pool_huge_folio(h, &node_states[N_MEMORY], + node_alloc_noretry); + if (!folio) + break; + list_add(&folio->lru, &folio_list); + } cond_resched(); } + + /* list will be empty if hstate_is_gigantic */ + prep_and_add_allocated_folios(h, &folio_list); + if (i < h->max_huge_pages) { char buf[32]; @@ -3510,7 +3593,9 @@ static int adjust_pool_surplus(struct hstate *h, nodemask_t *nodes_allowed, static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, nodemask_t *nodes_allowed) { - unsigned long min_count, ret; + unsigned long min_count; + unsigned long allocated; + struct folio *folio; LIST_HEAD(page_list); NODEMASK_ALLOC(nodemask_t, node_alloc_noretry, GFP_KERNEL); @@ -3587,7 +3672,8 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, break; } - while (count > persistent_huge_pages(h)) { + allocated = 0; + while (count > (persistent_huge_pages(h) + allocated)) { /* * If this allocation races such that we no longer need the * page, free_huge_folio will handle it by freeing the page @@ -3598,15 +3684,32 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, /* yield cpu to avoid soft lockup */ cond_resched(); - ret = alloc_pool_huge_page(h, nodes_allowed, + folio = alloc_pool_huge_folio(h, nodes_allowed, node_alloc_noretry); - spin_lock_irq(&hugetlb_lock); - if (!ret) + if (!folio) { + prep_and_add_allocated_folios(h, &page_list); + spin_lock_irq(&hugetlb_lock); goto out; + } + + list_add(&folio->lru, &page_list); + allocated++; /* Bail for signals. Probably ctrl-c from user */ - if (signal_pending(current)) + if (signal_pending(current)) { + prep_and_add_allocated_folios(h, &page_list); + spin_lock_irq(&hugetlb_lock); goto out; + } + + spin_lock_irq(&hugetlb_lock); + } + + /* Add allocated pages to the pool */ + if (!list_empty(&page_list)) { + spin_unlock_irq(&hugetlb_lock); + prep_and_add_allocated_folios(h, &page_list); + spin_lock_irq(&hugetlb_lock); } /* @@ -3632,8 +3735,6 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, * Collect pages to be removed on list without dropping lock */ while (min_count < persistent_huge_pages(h)) { - struct folio *folio; - folio = remove_pool_hugetlb_folio(h, nodes_allowed, 0); if (!folio) break;