From patchwork Fri Sep 15 22:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13387788 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 9EDA9CD37AD for ; Fri, 15 Sep 2023 22:16:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D565D6B0393; Fri, 15 Sep 2023 18:16:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C8D176B0395; Fri, 15 Sep 2023 18:16:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A949D6B0396; Fri, 15 Sep 2023 18:16:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 82A716B0393 for ; Fri, 15 Sep 2023 18:16:49 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5860240E0F for ; Fri, 15 Sep 2023 22:16:49 +0000 (UTC) X-FDA: 81240242538.22.86E2390 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf22.hostedemail.com (Postfix) with ESMTP id D0D83C0027 for ; Fri, 15 Sep 2023 22:16:45 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=mKt1cFDX; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=k6YUlS3x; spf=pass (imf22.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694816206; 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=oDZlE4S/P8gMy5+qqWQXiX898yEOVoj4504q4XjHrvY=; b=NFmymu5Idgx4pbxvsQn4cLKtrYXyYYhL26QQuYPbGOdgXHpol08r9s8NwBtqqNPF3gBwAY P6gujU5Yw272l2FdywEef4jEqI24XNW8BdshqOSNAl+VEdaNlvnkvlKsHfz1E6KximVXZX GFXgJqeg7LjG4/vjyPGd/eQIdPrYCxE= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=mKt1cFDX; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=k6YUlS3x; spf=pass (imf22.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1694816206; a=rsa-sha256; cv=pass; b=5YVpwcbJK6ln6+ocdHSQTl3mfseGp9PplZQSyRr4QIBZSU2NZGYUdsiustfwg4XOYLti5g fezaeXfp9sdIwm8FUBlcXEb/S4tuBrFj9jrgf2CneyHbXcqTB5RtDH1NQzB0jKzKpxNVNZ TrZmak/hsm9cjGZoOKgqdX7wccBgsmo= 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 38FLu271027077; Fri, 15 Sep 2023 22:16:18 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=oDZlE4S/P8gMy5+qqWQXiX898yEOVoj4504q4XjHrvY=; b=mKt1cFDXMM3bX/MOtmFd2+pfZcx8bJ6GVvIcv/H5BRhqDahR1YIACPUmdz9ayx20xvZS nBdlAZMZ1lxao2kbLNskeO2CXq9OPyBwNrFo5dXNyP6TTZ/uZHLnnhhH/9C4PO7XbMDa Y05xW/b2XWU0PvmpSSm/0GhVsH1KSWwkMrJlr//QNxrcXxcIE1aJ2Z61gEU2sLwQhVIG HLhVhtf7DpKZ6xO4Q7u0yKGa9TeCWMlhLKN2Q16o7Pf5YIK5gSgHDBnKH0K+y+y2NO9N x4hvIAOoOQ+9uWbMQY1h82Se1Xcy6b0l3whbgVrqj7NB45fufbGGH3adTVi9b1beou4A 4A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t2y7prp00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Sep 2023 22:16:18 +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 38FJkubT036245; Fri, 15 Sep 2023 22:16:17 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t0f5gx906-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Sep 2023 22:16:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kzAGC7o1JrV0jbbWIkfX5afd5Rq+5FWocmprUQ+1XPkQS0TcKRoyIIVq+eNZOQfkLcf/tB+uoEnzZyc6+qOsWTxpjaZHXQRTsDAI9aJ4Ywzgyt/TF8wdK6uQd2qCeEd25eHACuM30T/SqFGY8zkmn8YWn90dOn3TBQ6kM3mxv5vGgLLOlVuTCF8y+xzCknw1K2XbQ6NRQpw+3TQ4A0A8YOXOYgQ9xMuBtjR8x0aDIgRgEbnCXXHduKiToqGu4O9D+Cw40wad3frGZNKizlBIHQpM36Os3ufWeJIbrH9lGvQ1QBMWVBvhCeKWGXj5OWeFtbsv0c/LPCT2+YBrKggvkw== 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=oDZlE4S/P8gMy5+qqWQXiX898yEOVoj4504q4XjHrvY=; b=M04lL7M70r6xL1rQDM0gLzso/xnE5wlT+LHRk69y3fCDUWLR4YGYHN0Y15t3Wyma3N7W8AVUjEYPGfgWkso5v9LWKDX6jvQ64QnMXiTi7GcacOg5CU9nDUR/xbP+jzPmSYlYJhi/lES3c9MxBkM1baDlsOkH6vKVjn1+DQO0HaRtilxnGQlxZfwUr4CEtqyssrETtys9fIxa2RzQwAWMjmk4WLk6ZmYxqjJrUvSfeG/bMPb0w1oJR8hAO204tsmQWYmHr7CqV/ePRCpeFDvXeS7rBq3LsPCLNpMjRjVuPQ2NMKuSGUI/8azlqWMytzl4uimZYCPvuXHpub8p/AZ8Sg== 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=oDZlE4S/P8gMy5+qqWQXiX898yEOVoj4504q4XjHrvY=; b=k6YUlS3xhC5+3QWiCGxy+0ERPfQpLzvmKmMoBbHD4dzYkdwf+Dh5UOUMKcAPKuHYLaKYJfnB3vy8K8zMm1wweShowIx+OVE9ThPOyUOlotRlju94WzKjITF4Tu3KyP9o1YOU5ef+OVQ9Va6GfYGrel8h8Okz6Wn7WgGgEZwyE4U= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by MW4PR10MB5861.namprd10.prod.outlook.com (2603:10b6:303:180::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.34; Fri, 15 Sep 2023 22:16:14 +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.6792.021; Fri, 15 Sep 2023 22:16:14 +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 v3 08/12] hugetlb: perform vmemmap restoration on a list of pages Date: Fri, 15 Sep 2023 15:15:41 -0700 Message-ID: <20230915221548.552084-9-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915221548.552084-1-mike.kravetz@oracle.com> References: <20230915221548.552084-1-mike.kravetz@oracle.com> X-ClientProxiedBy: MW4PR03CA0022.namprd03.prod.outlook.com (2603:10b6:303:8f::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_|MW4PR10MB5861:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e2649fa-a489-4861-b9b6-08dbb6396010 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q4ZwTQVhXh9lCE5/f+eot+ZjOENl061bUSIa+DFnKR7MbtGK+Pz7dAQPw7sTS9rXN+BlgWYUpBjjRxi8TYa1Zn6iOCtgYOHIo7oYbTtfDKarUmX1c3aJ7EDI/UbtLejoCSAqixxF4hDtw/l/W8JCg16OntcZIW9fWz9EKR1duPJQmNlqEg8GM2bTObbsRdyRzkle2Q/PxJF4I6LMJCSB3oyiuo7eq2FjI3iIfrLRU/osxFohSsXWbLBcMomwEXeR+9BX8YUUmXA3C/o0auHgxqORgPwWMr2Qf+EbHjAwzQek4bmxkytElLN5wzh73fE9Qv8g+BrtOT3iBxdC6AV7fRtGdoiVs628ozoSCZgY6C3c0IolFW1FE6klOYMTjlN1OtgkpFX7e28tARlyq4/GWOSVwDhFw4z2pNV8kBZAMTclJw9B6hK6Hf4G6+C8bGL3h3wRfrj5DaqXIL8KmJz8mtMHeNKbX+vIhCZFmwdnw9ORhaIebbISnHJ2aNa5xcumOKW12TVoLUyMLn51ZRO7c1s0/LdQzMt3LKkNTKyf1t+nTnRPjyddOeRZoKMQcRkL 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)(396003)(346002)(39860400002)(366004)(376002)(136003)(451199024)(186009)(1800799009)(44832011)(86362001)(36756003)(83380400001)(2906002)(38100700002)(478600001)(1076003)(2616005)(26005)(107886003)(4326008)(6512007)(41300700001)(5660300002)(6506007)(6486002)(8676002)(6666004)(66556008)(316002)(66946007)(8936002)(7416002)(66476007)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dIzXfKaNi7kSWYx/yPd1aQd9JWjL5MdHxSmORWf+T2qwzSB9finOeKdQC81aDT/lA6SeSSRUyDj+5uRZY8KMQmY983PJwF9mm0DfooGG3zDKCyZkJUF4rW9mPIXecqZnHOa9HyR0xooeqXWKFRxWAamduJqK9B6yh1caclqYkUb8wzVHOE2+CMoYeol1BuSQOY7XXVs3jEquVAEXKA/92jYj5tZXwzAMhym7sTJMqaw8SWECZe8bjqLpYur2LxmqAQk+wKSxcBLtdTDeX2/CZuVrKYPD2yKTUSLtraZ9RnmtInQC8lzN1nySTSLXgLIof0qr2zoKw2wkiGuLen9Kyrcm17/CkoE5EYW7uYIjGQITqaE7cVt6XbSRs1CZ3+OUU9UxvdmDjIqtmaqCtpZtMIgtyV7TK/ssMrPrDUNyoJhvNjmBHK9+zZbH2fXQqJp1oDkKyTds7wC41BjKrhffbJSfJYezetZaNx9UgHYSsd0KuxMC5ouGsLcIUjvhv4iB4Guj2QzkvFqeVtG4GkmhsfSEJ8Ik0M2mE1KK6xnIOnSUGD0vw6DqPy7K4k3f70rphhSM2tyjSgVPRj5RuVR8Z1Oh5opFMATIvrwYEZP6W0A7ARxjvqPVWoBBG0gPh5I4ntTtms4ib+42S5Bv+C4s4cL4GIKwdbOl301Le6GMQlL7YdazViI1FbN0WOQQJK8N+iPt8nheLQCl+ob1Y06+Fs5NmQIKBCX1fa+3AmYQFECufP+0x7knDke5BmCPV/62qCPMx0jBHFykUMWSaCP91Pbeu84qdN5wJuuwHayndIonT73e5u3wsZTf3+WdgDmvq0M/+JS36Bv6FeiC3Ot2V3K9fSYB10hvCOfSrFrFOc3trRpqdyGiuIfAsAJ8biKGvHQMXkL8MlBuxlGgw3oQcoHSCWsh9HSaHFeIvYiU+d+MbINj9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QHALh4Rc07XefBCWBhlJ/g8yCUVsf/FG2MiZfy5yzaiNYJ5FL6XVbRCNovgwKDIfd6ymevIc8cZa4FPgg6CfojAXUNNyDw2apQum0SfmSZACpNwg2zti9h7Kb4GnxcuxhVRO5F40roucKHelwGdHiENxdCGanwsIs2X1+YWbSx81GccPe5aUVDCReTmxxcUJLr+J/QhM3x2G3cx19L0uku0HZ1UdtJsxzefhE37jUR2Kw06GQHeY79domJgGYj0/7Q5JqYAFqB1sVCa171kwSxcvjoxBkHyKHBfLlnzsoHWv7r9zbYFfL9lwJQcnUGXu234blJhav/klyCU6TgE2YEAYkj3iFHdjeN4GR646HlumAr0xxWSqGS9VulJl3a0p0myaNxcY4RIkTvSmWc8GJn2GLYH6dFzOBC8nHjd2NWos6YTJ9o7/p7QUyrBGii+7KoapPv9UhGQ02WMacefE6fX6s9ieTRJjoC6iOegQDoxK/VYtlxI0W0OHKqYzlHF6mDd7K5va3GlJdQIYyRnXwPC65DrQkFUyiQ7EoH9bEA5prZgcDVkl6v2OHRKF83K64/CQARp5HRGXGuXlgc81RcVe/D4pa86Zkwa7CV1NCoZVO1KxZZkPWJ7Ox1s3a2mBqn5DUaHggHcric3i6K0ABLK+kjBh/bG1vI011j2x/qtRVHguSCN4nzeD62Mb5kn7F85gBjmRSSeiERONh6KPEsypP06dh5XuQvMpkscQz1wH0kLtQK1XToj+DvRZZc217LswQR9d8/od9rITAq3lOwqD83jQ0o0/LVjAa4XbDlyLSHXULTT9wwHNVrITOo3nRiHPL X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e2649fa-a489-4861-b9b6-08dbb6396010 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:16:14.6150 (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: cVflspdx53e/Yve1leD8OpzAhG3ScWSztSflE04Mzf0pEBtZcvKXWsANcPj86611TOJ6druBWWGmlApZfylf6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5861 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-15_19,2023-09-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309150200 X-Proofpoint-GUID: HX_rZgjwfQoMcw1znlN5y-AMmK6nOOF- X-Proofpoint-ORIG-GUID: HX_rZgjwfQoMcw1znlN5y-AMmK6nOOF- X-Rspamd-Queue-Id: D0D83C0027 X-Rspam-User: X-Stat-Signature: 8jatjprhxa7iijrk53mmt3zncxzcwnfw X-Rspamd-Server: rspam01 X-HE-Tag: 1694816205-523249 X-HE-Meta: U2FsdGVkX18qRVRycjI9WuGztgwiO+TmNsTbJDrvkIutgA0ReQr2EI2NBE8F9whSHG3b2h/Hr7Szx+wWaQhfTARe8m/4VFjDrG6wrRzppBA6nGFDj1H3sM+8lAP0ZTdiFQnkivNukWEucYjL/hgJjZ5k8FnDRkkWaGZJF31kyRxC9zYkqqsmlDXzy4pznD9RpUWBN/FSYaw9Le27kvbbVwVjqJhaVjYy3udsK05NSEYyqZPfSwjAYnEY2Fk0iz5WWzs1kdwyEtbBvvEWkJJ5pttQCLex8xzq/w69ySCsomNC84tZ4YtIL+meanuq1DRllc8JNv5DRmaJoOjSFOhpfT87pn+4YDF5R70nKbiwzYvppSrg48ohoNSUOvbZwBtesV+OsPcDqXXViA7CCA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EzHg8LPp6MDjq3/rNhQCcfIZm 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: The routine update_and_free_pages_bulk already performs vmemmap restoration on the list of hugetlb pages in a separate step. In preparation for more functionality to be added in this step, create a new routine hugetlb_vmemmap_restore_folios() that will restore vmemmap for a list of folios. This new routine must provide sufficient feedback about errors and actual restoration performed so that update_and_free_pages_bulk can perform optimally. Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 36 ++++++++++++++++++------------------ mm/hugetlb_vmemmap.c | 37 +++++++++++++++++++++++++++++++++++++ mm/hugetlb_vmemmap.h | 11 +++++++++++ 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 214603898ad0..ccfd0c71f0e7 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1829,36 +1829,36 @@ static void update_and_free_hugetlb_folio(struct hstate *h, struct folio *folio, static void update_and_free_pages_bulk(struct hstate *h, struct list_head *list) { + int ret; + unsigned long restored; struct folio *folio, *t_folio; - bool clear_dtor = false; /* - * First allocate required vmemmmap (if necessary) for all folios on - * list. If vmemmap can not be allocated, we can not free folio to - * lower level allocator, so add back as hugetlb surplus page. - * add_hugetlb_folio() removes the page from THIS list. - * Use clear_dtor to note if vmemmap was successfully allocated for - * ANY page on the list. + * First allocate required vmemmmap (if necessary) for all folios. */ - list_for_each_entry_safe(folio, t_folio, list, lru) { - if (folio_test_hugetlb_vmemmap_optimized(folio)) { - if (hugetlb_vmemmap_restore(h, &folio->page)) { - spin_lock_irq(&hugetlb_lock); + ret = hugetlb_vmemmap_restore_folios(h, list, &restored); + + /* + * If there was an error restoring vmemmap for ANY folios on the list, + * add them back as surplus hugetlb pages. add_hugetlb_folio() removes + * the folio from THIS list. + */ + if (ret < 0) { + spin_lock_irq(&hugetlb_lock); + list_for_each_entry_safe(folio, t_folio, list, lru) + if (folio_test_hugetlb_vmemmap_optimized(folio)) add_hugetlb_folio(h, folio, true); - spin_unlock_irq(&hugetlb_lock); - } else - clear_dtor = true; - } + spin_unlock_irq(&hugetlb_lock); } /* - * If vmemmmap allocation was performed on any folio above, take lock - * to clear destructor of all folios on list. This avoids the need to + * If vmemmmap allocation was performed on ANY folio , take lock to + * clear destructor of all folios on list. This avoids the need to * lock/unlock for each individual folio. * The assumption is vmemmap allocation was performed on all or none * of the folios on the list. This is true expect in VERY rare cases. */ - if (clear_dtor) { + if (restored) { spin_lock_irq(&hugetlb_lock); list_for_each_entry(folio, list, lru) __clear_hugetlb_destructor(h, folio); diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index c17784f36dc3..0eeb503d8a4c 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -480,6 +480,43 @@ int hugetlb_vmemmap_restore(const struct hstate *h, struct page *head) return ret; } +/** + * hugetlb_vmemmap_restore_folios - restore vmemmap for every folio on the list. + * @h: struct hstate. + * @folio_list: list of folios. + * @restored: Set to number of folios for which vmemmap was restored + * successfully if caller passes a non-NULL pointer. + * + * Return: %0 if vmemmap exists for all folios on the list. If an error is + * encountered restoring vmemmap for ANY folio, an error code + * will be returned to the caller. It is then the responsibility + * of the caller to check the hugetlb vmemmap optimized flag of + * each folio to determine if vmemmap was actually restored. + */ +int hugetlb_vmemmap_restore_folios(const struct hstate *h, + struct list_head *folio_list, + unsigned long *restored) +{ + unsigned long num_restored; + struct folio *folio; + int ret = 0, t_ret; + + num_restored = 0; + list_for_each_entry(folio, folio_list, lru) { + if (folio_test_hugetlb_vmemmap_optimized(folio)) { + t_ret = hugetlb_vmemmap_restore(h, &folio->page); + if (t_ret) + ret = t_ret; + else + num_restored++; + } + } + + if (*restored) + *restored = num_restored; + return ret; +} + /* 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) { diff --git a/mm/hugetlb_vmemmap.h b/mm/hugetlb_vmemmap.h index 036494e040ca..c8c9125225de 100644 --- a/mm/hugetlb_vmemmap.h +++ b/mm/hugetlb_vmemmap.h @@ -12,6 +12,8 @@ #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP int hugetlb_vmemmap_restore(const struct hstate *h, struct page *head); +int hugetlb_vmemmap_restore_folios(const struct hstate *h, + struct list_head *folio_list, unsigned long *restored); void hugetlb_vmemmap_optimize(const struct hstate *h, struct page *head); void hugetlb_vmemmap_optimize_folios(struct hstate *h, struct list_head *folio_list); @@ -44,6 +46,15 @@ static inline int hugetlb_vmemmap_restore(const struct hstate *h, struct page *h return 0; } +static inline int hugetlb_vmemmap_restore_folios(const struct hstate *h, + struct list_head *folio_list, + unsigned long *restored) +{ + if (restored) + *restored = 0; + return 0; +} + static inline void hugetlb_vmemmap_optimize(const struct hstate *h, struct page *head) { }