From patchwork Fri Aug 25 19:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13366216 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 DFBBAEE49A3 for ; Fri, 25 Aug 2023 19:05:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17A5C2800D3; Fri, 25 Aug 2023 15:05:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 16DCB280055; Fri, 25 Aug 2023 15:05:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD19F2800CD; Fri, 25 Aug 2023 15:05:39 -0400 (EDT) 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 866D02800C6 for ; Fri, 25 Aug 2023 15:05:39 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5BB9D12078A for ; Fri, 25 Aug 2023 19:05:39 +0000 (UTC) X-FDA: 81163555998.19.D92172C Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 711CA20021 for ; Fri, 25 Aug 2023 19:05:35 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="z/xyJX30"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mbIFw+4F; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.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=1692990336; 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=hgjjLKzxatL2kLeVbyvUq9gKeYfImLdjnfaoRhKBwD0=; b=kFCGl7NzY7sO8M4Xq/JWzRi/7jOGt2BEiNiWqfok1hyvnZRXquHuWIFwkBM8X1DJV7ngpC UfhVejISYOcrec4OerdWM2DT5i4IZijeYBSVTTHvewc71wjLZUnIrQrV/cg4pg4b8No4P9 as+0VRnpH8SZpyeVXGw6wvk0UP65l0o= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="z/xyJX30"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mbIFw+4F; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1692990336; a=rsa-sha256; cv=pass; b=cxmRU/ycuziQbfjLnMvBoPIBtFFMKxR++R5T8GcJpDqlp/RabUW+MwZ3wNeu65y20NI8xA MD8JIOEoX+wvJAnKV6eZzViNEcc42gbcvH7DohM4K4uRezFOJoZLbGL0eFf87iVO4NxQEc GSm4viye7sTAB8DGPuzlQ1+WXdCxZBs= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37PIEWaI031486; Fri, 25 Aug 2023 19:05:10 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=hgjjLKzxatL2kLeVbyvUq9gKeYfImLdjnfaoRhKBwD0=; b=z/xyJX30XZCI2BsNidlskUASj7IscFRb1fZd8bEPimLqCabKlc9o+Z+JooI5a5wclB+n ksqugs727M3bGNT3/SfFBaKJvvC9Ne3n6IurVD+hDZjT1zpiPdssKLWX93RFuaMEcTk+ 3gIgxqngdlIPApKKck0b72HKcSK3EEwLGdtjA+Sxnrx8YQnySl55z4Jn6IZOsaH49p1u MhZlOzXbLvGnTr/aPTE2I0GQ2Qlm6Ne/X5MxSrNDWSI/LjiTEFuA9cyFaEixPifWuwJY RtAxEzeNiPPGu7SqLvmqIrnvduPDbDHOM7qj74m/KImZWaJz2l2JI//nAwM8ondUTljO Fw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sn20cq0dn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Aug 2023 19:05:09 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37PIUF51002259; Fri, 25 Aug 2023 19:05:08 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3sn1yyg8k5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Aug 2023 19:05:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jWrP9Qjf7um6WvLwmSCGrDhukrrmpgI1AcZTV5KSNEaeCiVIBXbzJLNzDqKyrB5ObIzKG0ij3ekKsiUqFwxg+awarjuunvAqOOB+yUBmUwRIWQikz2T3X/OdlkemQ3XVZATgOYoPPMchuxsITL12FangHZqIEtypOrh8wAMmCeZkpwDKj+5gdG9CKtyZ/sGvlwpZCaQ/YsY2ynYxPLhu9VbJAyOErVxfcZx0lBEOuCsx4VoslrVkXSKVktXRGz4juJ5zZAS7QhrwfcBjJlYtUvmwce4PIX45AnS1+uR+a5LyTCEXjnN75WwXJOMFCAgt1t/Hq3cGc9kUUTkGaBWCJw== 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=hgjjLKzxatL2kLeVbyvUq9gKeYfImLdjnfaoRhKBwD0=; b=THr6BKYBNTfAKpinJl98k1axbv0NvwhzQq9C05NTwdWkLUrlGFRgKwp0ITJmTGYh6ZLQZmKBM8Vlz7KCWi0hsQ7sNImQGqONnl0WiWX8OqxGnMzlvuPUTfdAB1r+Ntsvm+5kJCj9MPYxo7krlJAAoWPlO1R5AkW3VWnHclz41BWRHKOqwxlqmeMwcJNgcinDslSRhJJ7I44auv+ILaKPHOpjs7rj0B/o/YzSDXJ7HNx2KgWVDLUAprIu7F2hybSUwFP24pR0oHjxo+pn1JsybFXm2ADaFlOq1xHmMXoXQLstTosm5FEqgkbc7F76p+ME64JleiNbr+7ClK5fAeqYHQ== 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=hgjjLKzxatL2kLeVbyvUq9gKeYfImLdjnfaoRhKBwD0=; b=mbIFw+4FC5egAb6bkI13P7RO7pWnN315794cOe9Rp0cW06Ts7e9Vg2ukzD3OYJhVv6P6QWhPaFlFVc1Q3ULqbwqgmO0jjsXmYhT7xNPAJQrgqy9MenLTYgwlFa0w3xQgyeNDXTKy2Tmu1UVUYvQrnivZCm7hu6yNGNMomvURBao= Received: from DM6PR10MB4201.namprd10.prod.outlook.com (2603:10b6:5:216::10) by DS0PR10MB6895.namprd10.prod.outlook.com (2603:10b6:8:131::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 19:05:06 +0000 Received: from DM6PR10MB4201.namprd10.prod.outlook.com ([fe80::8057:a3e9:cbd1:252a]) by DM6PR10MB4201.namprd10.prod.outlook.com ([fe80::8057:a3e9:cbd1:252a%4]) with mapi id 15.20.6699.022; Fri, 25 Aug 2023 19:05:06 +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 , Michal Hocko , Matthew Wilcox , Xiongchun Duan , Andrew Morton , Mike Kravetz Subject: [PATCH 06/12] hugetlb: perform vmemmap optimization on a list of pages Date: Fri, 25 Aug 2023 12:04:26 -0700 Message-ID: <20230825190436.55045-7-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230825190436.55045-1-mike.kravetz@oracle.com> References: <20230825190436.55045-1-mike.kravetz@oracle.com> X-ClientProxiedBy: MW4PR04CA0208.namprd04.prod.outlook.com (2603:10b6:303:86::33) To DM6PR10MB4201.namprd10.prod.outlook.com (2603:10b6:5:216::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4201:EE_|DS0PR10MB6895:EE_ X-MS-Office365-Filtering-Correlation-Id: 483753e0-17ac-4bfb-518d-08dba59e318d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hnxJSfTikXoHKsRYQD9iT+K3jM6MTMtZxAy/XGK46jZ7HEIpBoWISR8uDWPFn8++wAZ8LYxx1KqAUwuCO4M23mY3qPJyLfc7Oi3/sHTjeHqVM6le0uk157eFpQ846/lBQ265kBLXJQ4Rr1qoxUJ0829D1zq8cDeDoceWXKEf0hd2DGXoVb7pHMI/UVusiF5oqsanZw1DDC6EZiNVkthRH+Yhr7L6hDf8oqPkKrgOtaXdsrGkyV9UjgLiptoVARfZqC4/4luEPBoAy4UVUrqwD32bVV95LQLCmthoq+k9MM3iJTQUkKbzaFUMR/ycdjDB1hX+oBnsMgJiY6r+syOmHquyysvm40VQkiR8aVV17QG6niCc5PQ+0nTtC1k+ujXc9HiBKf5bip+GKVGrbW7Njt4VrXEdqWezAqfGD/gXfBMukZU4MH2zpbiEGN148iE8xEBPIAqiJvmeDvAysspYSvptZ8WeEcLVTxhW9arqqPV+e6bnaTHsHhBTIv1yZBS4eksQPzoN3IKsPAp+iNnDl0IRUnvMlZsmRU61oVryVR4Kbxvll27+FcTruszQFnoj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4201.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(186009)(451199024)(1800799009)(54906003)(66476007)(66556008)(66946007)(316002)(478600001)(26005)(38100700002)(6666004)(41300700001)(6486002)(6506007)(86362001)(6512007)(2906002)(83380400001)(8676002)(8936002)(2616005)(4326008)(107886003)(5660300002)(7416002)(44832011)(1076003)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5rB4xzcCPyDfCyc5Hc3/aQ6oM98DT7rh2cRVOm85p7CdUdnjDz+cfVDhft0w93PBR9ANwIf6U1rK8D279FsQBRfgcPktOYnnY+1GcfXGNXBSk+27LRfc9MG/wCyskxJM4CDLcEN7OYNPlUQP6vOkPp3mpnOxRsvppWIrQvkdwFAhT7+TBo365HbOlEi3v3fh+piTzyR42VfuF0Pt4W3wWJC1HzvqgiVfkrNmzkUPF0jnb3EXO21nta2qItfQVCTrL+7WLnj9NuTsF3p6HNjMFu6vPz3yY4DyU2k0Cv8724Xr1iqs1572ItAygEOOGSeGAgmdWTwIWtD+KZrJsdw7uqG1Y8iFPrldBd1UZvKNkRdrcuYHzOhOmKlaA9RFqjPRI1PbjWCh7vpbfpAMYFxKHIwDd3X5QhMJR8xdXY7Fza0s1PGMrn7aF1YDntUmbEpFOEy7SBFo8I0fuyqG/BHV8fS34mQ41oCDxK1278cTXJkMBThIpK3to1IY7CaxNvOfkEB+CA0lYHudcyH2T4Duwq9DQJei9gS42KQrK/K3AwtwsS2fLHd8rxXcYzIanZ9ox2IaYhHj2mcHDgmaP8eAlm+Vd9525N5WTESOn9t0B3i9KaGopioDym1yidAuB38lIcijOIRKG3U85xH5gAIdQAtcrVHhJvEGngPN8SL0DJNNFbE0jiG6sUhqph6QsBi47twaxJOn2cPD0xEJAnSqtFIqHA0Yl0W/Jp4edzzYsYyHEKPbXy4o1YVdtaZfH2RsQ0eUHgrLsHuJoce2sj+IgVbXCHiQJdhOIlCm9cnkjOfFaOkigKxv4glwDInvMQyX3xqmg3UtBXpth+vXoub759RsC129ZwxKsEiLm/SWBfZqQxYMQXCqYitrH96XO8Tlp/hlXjfQAOnoFaaenHCIxQP5xRtSjoNt2okG/EUHIGaUo00At50r+aKhz2IZrVEEIfPXvEiE/6PQWAmtLAps2ynfcPgpMUMjbWom5EnEe7AO2xXzgJOTiZiQnp4QeCtCtbtUb98k+cmvdgVBzSsi6i1Eo1txescs+o3CGw6vJhgCXEzKZc5k8RDZfcf5Hzll5Cn3jh5qEqxQO9c/ki35QYxpKlzriVbvfySk9oI5rqrLQWLdZEg6gql3Cw8K1PRXIDQOUlNCCtR5EngpRsrWk/6NpNegLFCDCp5cDskXsTNTfgTJe+dEx552XulxmSZXpSaNWUcbVRIFr7Wh9fQGjdOhw9RWdB33WjgxssFERqtvai8iOwIKCy1pkhQaozTPsPoaVg8hXPoukDfK4YEGJD6va6dNqguQ+yeCNR2pDKexJ4Pvdv2USJwCdnxQ1j5Z5WHlvQtaHY2EVeJ1SF9UTRNYxhqsN4RjpPLRXQUFHslkNw2m3C2eDCBS9r1hGyaedAAv4DzeapPqrD5dUauSAzVo4O30Yq0DcaOmwrhMD9cUZKpQf2jMzPEn+x7UNHgSNNujXIWdwXLiVwURNLgaepwuluyMULG+N1vfdBiTxc/xfodwmpHAbXqDAXEy/sPFc8cbG2tDEl6N+KJselax2lK9bcf0+Jewv0rSvW9Zs7wOiBlb8YRGVMPDEdwGd4HWWrjj/Uh6TsedaJkB3RGR+w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wspp+Rq31laP+o+2y8YLGL0kHUIVl3+YPry7w5JVbxpZN+C4QHqWuvYAHYBwxlaqWbMULS8XxOTX/PTsu3rR4+KPRiCE/Mw8ZZdCdFqoXPdvLz9lnBqXT6Us1W11VBdkABKQ9wTfJRJnfUuIUtmiQ6hFj6MaycrBhg7s5c8uuwD39eO2pDgBdrioz/u2YKBkntQBsz+6DlUGSCigvxL8ZwfLKNGKxdQdbZs/npko62ns8Xpszzr+7twyPHHbho3PaUY0UAwiPHrTLne+Vkjpwe40wtBTNyRa6qt8tYdFzh4J5/6XJDGwe8GyoDBuo91YMvr7QO90Wxuw39JsoAD4PO47Ptp4yeIKlKiCM4bGU55l+U1QAFBjOibmsqaYlE6O5qiXovxEjNWj0hKA7cYKMYYxCCB+oJ3FJhk5128GI95mewG5mynlgR7sOl9PzWFiquA4UWUt3qZIB4C8TXqY8ojOiUWkmSJf0IC2wYuSRBIt+PEhpTFEIYehXsyk7CdRz4vnj0Z9mMpbrtI+xvrasYPzk8JN5D2QWGtDyFqpLc89EQOf2Ogf6aSKZUHreCkLJH7HH5pKq2izIGCfQGDj0gQrhrrt8e6QCTp1UDixYd/6LHkgfbQZXPLHeeruAsuGdN7plhfFwZCKUUtzLF6oOdXhWsy94fD5uWcRxxX77fNwX/ptIgylzdZ74K5oVElI/wIfWPd7oYwV0RngDfYQqHOaD4gOipnV7ILCGL2n5ZKYtm96aFjK/3ZInw7boeLaf3U2224uu3Ove6/TLxiacrU80NSpcuKTAm8TDYb4n10BwNjSVJr22PuIivRY4jWp/GJt1JZ5fLe2PWVkATOtjiZkrTREv6dsFn2saRHyXc9ea0lOivoxHThl4kXUafhBbTBcAxibRCuRYb/I4s/KWOUXo0oz5+Eoor3Luow+ecUFXpH0LdSZ6RGfi5mqkLGaCKQ1HroxFUr6EjFgxME/7hJ2FYlAOntvAKOoPCOG5n5TbvZEoXIB2mybVpbHGyOCk78At6aZb8FPjRaLuoNFps+gwCLVIXVclMNyB0WPmdHZLqqUY5ZUuf/lZ6OMe++KzIRgMsSF07fFKrPE0QRCrh3MBGmcPlgr3MRDUyADdkXV37XOuXqqGOtYiotx6LPQ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 483753e0-17ac-4bfb-518d-08dba59e318d X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4201.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 19:05:05.9692 (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: dX+NjcmF7KoWhK8wcA4xqAm5kCIA1KOFBpz4srQmQ5MoLXa43OPjiibUGHBzumcX5NvziaD4/g+aYTJPpR3Ykw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6895 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-25_17,2023-08-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308250171 X-Proofpoint-ORIG-GUID: f6SQZLyQGTPDeSD3UkeDiDl_BnIG-U0o X-Proofpoint-GUID: f6SQZLyQGTPDeSD3UkeDiDl_BnIG-U0o X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 711CA20021 X-Stat-Signature: tqot8kw7b5xoymfsz15trugkoriqyt7n X-Rspam-User: X-HE-Tag: 1692990335-376608 X-HE-Meta: U2FsdGVkX1+VaJiAahOQgDDP7jp9EVpuqKaUj4SU/qde3oSJDYNFdlBg5nPws8xtmY3mIpRWqd5opySFKDis1myk0JXj2besTyw1IeerYUsHQjJA5Uc7rEohCVATxVOYFG2XmYHEMqtPUuTVmcEEBfn73SK0sPr0o1d5UvrAXpiLOr0C26ayGicanm0EcadplY03HlP5pq9DNn3WmAG4JFeU7Dss1BrhMD607/k3ayHQ2e1PsL6JOByZXlnxtI9v7ZWSllR3khDcve982UwrY2r3FGdHitRVqmYqVbuZ22yzsFYmOvw17TMQJbc3smj5O3PcSCFZha6oJnGlRaeQE0NcXs7MvWRkEYByaTAYQP0kf+iIMWEuT+B3M6Uo8k6hibaUndCNOAAxmw6iAf4owNtH4TQ78qBgD+IJ8Vntsww6Sap+rroudqOWOdeHJAvpCl1GWzVW51csLnW5D9Q0Hf00A1tOJ5lpStpiprqj7cJQhcWBbUDilzK62bN/hBaeWTTVnkeYfc4DuPXoEZAjfPoYnMyYbxEEqhmmvh8wzN4fwlWF1az8WmgLYwriXQJkZyYxWgBtHlHoxH4TmBAWtA1wE30TVeeZrWr70B19yz8LSZUYAQqMpevtMkii2xgwNBYjye5JDnJCet/g7llX5epLoOzgpjvQBD+/oN7f4iIXYtpJFxSx2Gq+doGPynocbbunAkIFPq+s/nfivdQATz0SDt6iffrCkFkprSXS5lSxPd9F4U7ADdK667gUMByZlHA7UvDvaBfSTdfa7L7NePb0/0yb5zlpduchZf00ir8AzliKN6JX1kCzyjbem6AHp9PizLp8ZlctH+JpZsY+HCAP4cvr2eHdiSrsMSCzPelq22UtTM3DbW4d3/eooayscSZEdt31SXRD7SWHC9Lu+R21IU4vktvLvl5YF6X0PGVTEQ4F/XVW/20zryLooY2eZikp8lMjr4VrnccpD4x /zw/3hcn L+dI18j+PKvmAIeK3DrqfP8hYGiQNvixb9s8GwUeZ8ppwsoSDfREl4uPFuwTzoqFJ6jmnvI3+esVycWf0tAqyBOW/1YpWh3fVXwVtQ/Z/96lscOoIqb0iwHAyhfXSQ6npR2vS99JVdmiRAPNE3VFS4zxig03GIwei43tYd5uWB2Lttt8E/8DcP/9xjB3y7jynlmpp0aXOusnRO/EmOQciK2SRgNv/70Iudjpn53jvfUsWBpb2PWU3ccOCkz3ktfx+bfS1tpeLpuli9LHTfAV0Ab0UC42FXQLmcCQY8FrHjRi0JO+5SKRkkPf/nBa2RytFsNbJ5B4l1giLzbMetp4taVUa+7khsDl7kiVzO7HsXfOTve1bMvdq9EWWWXhQokrAyTBg02WNoZ6XRkdqKDqH0FrESmBRFIZmK6OD/3rC179UcvAXLLKYcdfpWVk+fTV6QPHMJ9kctEOFE3aK3J1pED8WE1Tp6onGEvr7 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: When adding hugetlb pages to the pool, we first create a list of the allocated pages before adding to the pool. Pass this list of pages to a new routine hugetlb_vmemmap_optimize_folios() for vmemmap optimization. We also modify the routine vmemmap_should_optimize() to check for pages that are already optimized. There are code paths that might request vmemmap optimization twice and we want to make sure this is not attempted. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 8 ++++++++ mm/hugetlb_vmemmap.c | 11 +++++++++++ mm/hugetlb_vmemmap.h | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 452e7ed6dc36..3133dbd89696 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2223,6 +2223,14 @@ static void prep_and_add_allocated_folios(struct hstate *h, { struct folio *folio, *tmp_f; + /* + * Send list for bulk vmemmap optimization processing. + * prep_new_hugetlb_folio (called from prep_and_add_pool_folio) + * will also attempt to perform vmemmap optimization, but this + * is a NOOP if already done. + */ + hugetlb_vmemmap_optimize_folios(h, folio_list); + list_for_each_entry_safe(folio, tmp_f, folio_list, lru) prep_and_add_pool_folio(h, folio); diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 4b9734777f69..147018a504a6 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -482,6 +482,9 @@ int hugetlb_vmemmap_restore(const struct hstate *h, struct page *head) /* Return true iff a HugeTLB whose vmemmap should and can be optimized. */ static bool vmemmap_should_optimize(const struct hstate *h, const struct page *head) { + if (HPageVmemmapOptimized((struct page *)head)) + return false; + if (!READ_ONCE(vmemmap_optimize_enabled)) return false; @@ -570,6 +573,14 @@ void hugetlb_vmemmap_optimize(const struct hstate *h, struct page *head) SetHPageVmemmapOptimized(head); } +void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list) +{ + struct folio *folio; + + list_for_each_entry(folio, folio_list, lru) + hugetlb_vmemmap_optimize(h, &folio->page); +} + static struct ctl_table hugetlb_vmemmap_sysctls[] = { { .procname = "hugetlb_optimize_vmemmap", diff --git a/mm/hugetlb_vmemmap.h b/mm/hugetlb_vmemmap.h index 25bd0e002431..036494e040ca 100644 --- a/mm/hugetlb_vmemmap.h +++ b/mm/hugetlb_vmemmap.h @@ -13,6 +13,7 @@ #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP int hugetlb_vmemmap_restore(const struct hstate *h, struct page *head); void hugetlb_vmemmap_optimize(const struct hstate *h, struct page *head); +void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list); /* * Reserve one vmemmap page, all vmemmap addresses are mapped to it. See @@ -47,6 +48,10 @@ static inline void hugetlb_vmemmap_optimize(const struct hstate *h, struct page { } +static inline void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list) +{ +} + static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate *h) { return 0;