Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp81383rdb; Wed, 18 Oct 2023 19:33:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErncdgRWSoOGFoIyIzQ/dscszwIrvQ6QuavyseLCon/fV+/Pp9JKFq7PclUOEgauMVaRTM X-Received: by 2002:a17:90b:3a8d:b0:27c:f8f4:fedb with SMTP id om13-20020a17090b3a8d00b0027cf8f4fedbmr1010745pjb.21.1697682835020; Wed, 18 Oct 2023 19:33:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697682835; cv=pass; d=google.com; s=arc-20160816; b=HxO3FfhA66TasMOUkF+8RqS5c6j9SAsvZSmXKHYBrtO/jekpH6wpvFYVz70NprYXGX eZr7GFKuPKMyEq02ym+W2B6aXg8BeJb4E4uDLoQyRz+OQQ8X+DDCqolHSIv49h+UqdgF bzk90BTXi1HextZaaofoZVoOfnLxTOCnmVtJ0SSPK6YKjmfDve42yfK9zEfDEse+sreb 9cFHyzaOP85+smzL9pQCvCXVVxqStPkkpVaSGHlxdmaYubBXxjV2+8FjjR7oLUs2sjz8 rjtpu6XiZHOW/QpG+QShtYZB8Y3ynNRsR87ewYVLcY5BXs9Wl+fi3bx6hRF/zj/PfVKh feMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=8r2l1Or7Qj9qRoidjA9mZu05EoMF0cTpWPoXgE8Q2W4=; fh=UyYPwsm9/dCzP7cq/bCZi/t7ZNVdSe5aNPkVp3oGn8I=; b=KauCOAL63D4dtS324rEaftKZBpDzThFVUBtrUmA8vqsTRA1BzsB9lYURLMBvX8J5h8 2XXme9QtHPFBFgWWnLVolHulbZJDiIogl9SbVC1UPkKZTmINMFy17KrfxYDPC//KQ2tT YK/RGcc77oE4+/miMW40yEo9eNmKfyQZtGb8y8bZmkG/Ji5V1gfibegcrr2na6pmxBOT 1W+nSV80yRnq2f0xZSZx4J49Wgt9MQY/KGrM7dX9Iz5TchD+Ayb8AkUO3AWmMvPnQ1yZ b4jMcYOzHDRiVZdcZDRx1WGRdD1IL1fm/yY7sxNCI4gejsIAzGhnx9G/BubaOPG/IK6N T28A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=mNVJ2XFB; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=aQSKQ9mo; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id f9-20020a639c09000000b005b02161841fsi3386566pge.277.2023.10.18.19.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 19:33:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=mNVJ2XFB; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=aQSKQ9mo; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 544468098498; Wed, 18 Oct 2023 19:33:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232569AbjJSCca (ORCPT + 99 others); Wed, 18 Oct 2023 22:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232480AbjJSCcV (ORCPT ); Wed, 18 Oct 2023 22:32:21 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCF0AB for ; Wed, 18 Oct 2023 19:32:16 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39IIp68H019566; Thu, 19 Oct 2023 02:31:28 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=8r2l1Or7Qj9qRoidjA9mZu05EoMF0cTpWPoXgE8Q2W4=; b=mNVJ2XFBwfNoTmTbxzmvibG6lEp74QnqfHwO71GmtuPumdaUbCo/arLA28m73DEnbKX5 E9U2jT1HSmnQM++Ykbk4EMedsyBfWwBJBtkhp0hXF4tx2wVZHxpXDYZSktUonRsUmQsf Q6vv1bmYoqXMX+paJmlhbiwN5yWkNjpUAOXpeXl5ku0XMISvjVXxIihF2zjegHSwFDJo M8jPQhAjuJkmgYvrbCOIGdPP7+hNkB03nL5ylh0otJVX8RUSo39vKxvTTxu/21ws+6UI Yvn+lE4yAedqv6Bsq7l+MrJ/enXUbrqtQm/3qEOnuZG+JaS5IPQQAfNWBxBtRRGDvmfI pg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tqjy1h57f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2023 02:31:28 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39J1v2ei021568; Thu, 19 Oct 2023 02:31:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3trg539w05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2023 02:31:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QMTVGVYc+lUFA3ppGBDmczb0kuK/MAuJKFFcM/TZw5q6L9KpF865slyDve6xgRvGZ7C2fDP9OzE0o8+Qvv0lkmRYcNl2Isp2/vLdIXQaiQc25s1AgXQRMBxChsKL7X8Ss0STtTsrUL0+4ORaH2xIAdEdtCvM55TPpicC0eQsJl0337c4PMgaoJeZe9kDrdwlBjY+pGbfZueqNFEkbr8/nG4i/had85k0S1mVWFOO1MyjUAcqIAOSnDjhZ9v+l7co+WYYruTEPUbO81ogRPlmTHE0Ds+ylWMuiUGx2IExlDm7533lkYBTzWsBxAzWwue08TB3umzVjyqRbTAcDTzcvg== 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=8r2l1Or7Qj9qRoidjA9mZu05EoMF0cTpWPoXgE8Q2W4=; b=ipiWpJc4WWwTyJmV+cNH5JG/EEkq0HhHdMq3s3dNOYX3BojVTd2v5fnxW4XDw9ovAoxEUIylNfOdKgz+/T0sh3F3jzSckFSXR8SZh8u/87n7piNLcxp8NupaXonSW/axRfOvJrCGmphUU57xzqKSUwwfSd4w537uCAgPfdDX7tBSXlzLCLMeWD2g0xxzfXJ3bQvjRHgSLXjkuI/Lu1IJjrp+28sgUsRB2k2TENuZZRwiFW4v6tdO0SYNNqMTSe1yRxG8EHhIpK3xr+iwBVu/nuP7Wgkv4upwH8g36chU933zNVMW4ll5xpTssRQwS8Regxnu258LpRIj/UWJ/305bw== 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=8r2l1Or7Qj9qRoidjA9mZu05EoMF0cTpWPoXgE8Q2W4=; b=aQSKQ9mo8ZEdeNH5nZ1T7zrpw6WNL2c079P2GHNil0hS02qc8y3oTQgpnO2hOtLkW1GClusfoVlrjvXcWM4IkAkoDRqLWjPAb3pm21F3ZDAP8f99dhkxqw84A90OQA7jIGEGK4W5vCCea7GxpxiU+gEWW6XXN5czYz+7kTdCUr8= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by CY8PR10MB7123.namprd10.prod.outlook.com (2603:10b6:930:74::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Thu, 19 Oct 2023 02:31:25 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::59f7:ec45:eb41:d8c2]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::59f7:ec45:eb41:d8c2%6]) with mapi id 15.20.6863.032; Thu, 19 Oct 2023 02:31:25 +0000 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Muchun Song , Joao Martins , Konrad Dybcio , Oscar Salvador , David Hildenbrand , Miaohe Lin , David Rientjes , Anshuman Khandual , Naoya Horiguchi , Barry Song <21cnbao@gmail.com>, Michal Hocko , Matthew Wilcox , Xiongchun Duan , Sergey Senozhatsky , Usama Arif , Andrew Morton , Mike Kravetz Subject: [PATCH v8 3/8] hugetlb: perform vmemmap optimization on a list of pages Date: Wed, 18 Oct 2023 19:31:05 -0700 Message-ID: <20231019023113.345257-4-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019023113.345257-1-mike.kravetz@oracle.com> References: <20231019023113.345257-1-mike.kravetz@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0322.namprd04.prod.outlook.com (2603:10b6:303:82::27) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|CY8PR10MB7123:EE_ X-MS-Office365-Filtering-Correlation-Id: 25acd7a6-c705-4aca-d65d-08dbd04b7da5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4dBZAFNB3bSmlIzfck9KyqlwHScQhvOzLzbSYo4nTk8My5BNBMOgAcufArANNvufEqX9GUDVYlr56vcCKwm8JZuMc8+6d/sq4w4k1relyi1aekFdZYjFLbjvsuHljzWcbPGU0VUFvp7CjtHSmdW1z1NzIjFc+C+2hJUyPV/AqgFt4rONLycNgPfkoJ4Y4T6+aUTY2qB2VuJxwEzOPy0sMOVCAfIMdy8d+1t8m4ITAhnelaWr8UlZljnUzPEXTly5mQbVUaDyrw8lZxCJ/wBrNEB///ghKkKb5r2UVQ7niOOxSyhcYKFxJpCxMCjVaTlK2axpm9A3tmxyIIDmkB1pqYmZYY7AG9TqJ7GTnsnwYlIWuVCYGNxuPDedednSf6MaOMF4x79G3qGW9ewyFTQ/7ZvkxHcQ/oxKvtLV5brvGBAQ3J8hUziQkrDfy3/v8MhykKRyQmk4Tdc/60u793CkS8AS96dm++oCN4upwbgk7awBxsFyiBNs0+EHx2cBhdu8zdg0nWqKIXdn3xyZsf7a1rYh/vPu5Tmf5Q8T5pguis9KHf+KNCY+7IBfk9gU2Oyg 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)(39860400002)(376002)(136003)(346002)(396003)(366004)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(478600001)(54906003)(316002)(66946007)(66476007)(6486002)(66556008)(6666004)(1076003)(86362001)(2616005)(26005)(6506007)(36756003)(107886003)(6512007)(8936002)(2906002)(4326008)(8676002)(7416002)(44832011)(41300700001)(83380400001)(5660300002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/EG/6gl6/mWFNXw0eiqCmPlHYfNUhG+MLrxZx6JTkM8fzDW4dgfkkB9PNPUv?= =?us-ascii?Q?Ptn8xp2vmlK22QlcPyN3xvUqBrMBvBk1y+EFOBxRzCQJRMqW4XYM4lkIy27O?= =?us-ascii?Q?SaI1Ss2MFK6XP2uV5ZR35HhBbtfM7y0rU1rQfLvaEcJhrEZvvepa3XCSsH+K?= =?us-ascii?Q?4EvhDWj2hWc3fDjGKuAivBwyE9kobjG8WBjlBayRcH/ce0zuU7MuX5NzzmwW?= =?us-ascii?Q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je1/zYX8gQfAGzcINqARHsYOL0of?= =?us-ascii?Q?eEmQLAwd3BM3TU2amwVdwUVfGCV8wBojwrBBnsvtkqGjWU6ez1Pk7nZ8odSQ?= =?us-ascii?Q?P2kXNP7vZW5eYAnRdYnJIcKB9UKE4d4flzxV8Aa+v2QI3YPcf+nOvkSf/L7J?= =?us-ascii?Q?Y9JIlAmwi0fBxNwFyqIabrB1AxPDyIJrfKi91yMdWyCAN6EXS0CCpm84oEe3?= =?us-ascii?Q?YVm5o685cWzRQCdS1dSVoxvr3RdCxGYZB7V0/m2nR8k2ac6hxy1aBEi+wPAj?= =?us-ascii?Q?Jxouc7iQroQu1Rzoylkf+QdAmP2uo8lhpYKj+Br3gr7hdL/lXLKxe9QJFVDK?= =?us-ascii?Q?48PzWX/8gCVROYMYSdBMhT+jQUR68LPKF++/llkFj3Umi/HQ55x5JlY9dIcj?= =?us-ascii?Q?LRgXq8esPijCjWxjRo1StE1veIInRZyASt7QCEmd+aij8ZM9e/pPtXJGU7us?= =?us-ascii?Q?+foYLSgxTJd7Hr6t0/DkWNWYuBUc7v1ShOSZFxTQ?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?us-ascii?Q?ocGngHMWx+ZJ+sFS0QWrHCgIzIY2gZTM2f0xozHLCBOrkTPo1BuicFmY16QO?= =?us-ascii?Q?ge5Njlg8FWgP4KTBXI/AkMOliHs1ILoYfQSfrWhTYAX6g7USWbjDlGiB19GE?= =?us-ascii?Q?bxc9iSJPuEDRS50Xmnac0P8B2km4nFqflSltiH8Rb0lFhEM4nNOpI5QpiU4Q?= =?us-ascii?Q?7kBY6y26b7zbyYNGmB6ncJEvPgjjJQbVAFiKHESOHnur3fQvqd8c1xseNla7?= =?us-ascii?Q?+F2RkJyXm7LJs1Pusgkyd6pUxL0jhUTBVhBOuOhALWEJGbvJxgj2QkGVunYV?= =?us-ascii?Q?C8v1TSSHYHzXd5N8ve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= =?us-ascii?Q?FSV5vZ+AfxI5bzDm?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25acd7a6-c705-4aca-d65d-08dbd04b7da5 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 02:31:25.3289 (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: 913NOzdLuCmNHf9Cn7zKvVS643QaZsgmNYQPV4aMnT3yI8TZeBFsWBQOC+61rSqhImYtiZtNtbgH9NCB1vl7Jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7123 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-19_02,2023-10-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310190019 X-Proofpoint-GUID: _fw7hiRPovR_TVqvzHA3Wm3k3Mm_F8Ij X-Proofpoint-ORIG-GUID: _fw7hiRPovR_TVqvzHA3Wm3k3Mm_F8Ij X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 19:33:48 -0700 (PDT) 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. Due to significant differences in vmemmmap initialization for bootmem allocated hugetlb pages, a new routine prep_and_add_bootmem_folios is created. 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 | 43 +++++++++++++++++++++++++++++++++++-------- mm/hugetlb_vmemmap.c | 11 +++++++++++ mm/hugetlb_vmemmap.h | 5 +++++ 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 559f7c71c596..8b171f866d0a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2282,6 +2282,9 @@ static void prep_and_add_allocated_folios(struct hstate *h, unsigned long flags; struct folio *folio, *tmp_f; + /* Send list for bulk vmemmap optimization processing */ + hugetlb_vmemmap_optimize_folios(h, folio_list); + /* Add all new pool pages to free lists in one lock cycle */ spin_lock_irqsave(&hugetlb_lock, flags); list_for_each_entry_safe(folio, tmp_f, folio_list, lru) { @@ -3344,6 +3347,35 @@ static void __init hugetlb_folio_init_vmemmap(struct folio *folio, prep_compound_head((struct page *)folio, huge_page_order(h)); } +static void __init prep_and_add_bootmem_folios(struct hstate *h, + struct list_head *folio_list) +{ + unsigned long flags; + struct folio *folio, *tmp_f; + + /* Send list for bulk vmemmap optimization processing */ + hugetlb_vmemmap_optimize_folios(h, folio_list); + + /* Add all new pool pages to free lists in one lock cycle */ + spin_lock_irqsave(&hugetlb_lock, flags); + list_for_each_entry_safe(folio, tmp_f, folio_list, lru) { + if (!folio_test_hugetlb_vmemmap_optimized(folio)) { + /* + * If HVO fails, initialize all tail struct pages + * We do not worry about potential long lock hold + * time as this is early in boot and there should + * be no contention. + */ + hugetlb_folio_init_tail_vmemmap(folio, + HUGETLB_VMEMMAP_RESERVE_PAGES, + pages_per_huge_page(h)); + } + __prep_account_new_huge_page(h, folio_nid(folio)); + enqueue_hugetlb_folio(h, folio); + } + spin_unlock_irqrestore(&hugetlb_lock, flags); +} + /* * Put bootmem huge pages into the standard lists after mem_map is up. * Note: This only applies to gigantic (order > MAX_ORDER) pages. @@ -3364,7 +3396,7 @@ static void __init gather_bootmem_prealloc(void) * 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); + prep_and_add_bootmem_folios(prev_h, &folio_list); prev_h = h; VM_BUG_ON(!hstate_is_gigantic(h)); @@ -3372,12 +3404,7 @@ static void __init gather_bootmem_prealloc(void) hugetlb_folio_init_vmemmap(folio, h, HUGETLB_VMEMMAP_RESERVE_PAGES); - __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)); + init_new_hugetlb_folio(h, folio); list_add(&folio->lru, &folio_list); /* @@ -3389,7 +3416,7 @@ static void __init gather_bootmem_prealloc(void) cond_resched(); } - prep_and_add_allocated_folios(h, &folio_list); + prep_and_add_bootmem_folios(h, &folio_list); } static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid) diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 76682d1d79a7..4558b814ffab 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -483,6 +483,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; @@ -572,6 +575,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 4573899855d7..c512e388dbb4 100644 --- a/mm/hugetlb_vmemmap.h +++ b/mm/hugetlb_vmemmap.h @@ -20,6 +20,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); static inline unsigned int hugetlb_vmemmap_size(const struct hstate *h) { @@ -48,6 +49,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; -- 2.41.0