From patchwork Tue Nov 29 22:50:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059286 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 C1754C46467 for ; Tue, 29 Nov 2022 22:51:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F5FB6B007D; Tue, 29 Nov 2022 17:51:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 958636B007E; Tue, 29 Nov 2022 17:51:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AA366B0081; Tue, 29 Nov 2022 17:51:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 560026B007D for ; Tue, 29 Nov 2022 17:51:08 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3106F160F4A for ; Tue, 29 Nov 2022 22:51:08 +0000 (UTC) X-FDA: 80187977016.25.FEF6AE2 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf08.hostedemail.com (Postfix) with ESMTP id B736C160008 for ; Tue, 29 Nov 2022 22:51:07 +0000 (UTC) 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 2ATMDrpT003552; Tue, 29 Nov 2022 22:50:58 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-2022-7-12; bh=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=rdUq6asB04bq4S+8JctIthM7n90/mFKk6Mh1v3Tykh4ji7X6OWUfg8Z9qJTdPlUR1QqP NqRfFZWEgzo00wziieQAdOgL5m2arsU1ObzGdXuxP1aPbJuVT1Wjf4m8qHXgohTDVzBe 09dmRB1VHYWXP8eklmh5C/s+0SMinsdnyDAbIjZ+b4KDTb7CiTkSyl7ZH+9Qm+G5Cn4C ET2+cuDXw33ZAaXKLpOe6mxoVYd6HeRnJp9wQ4B1UeWrW3WU3zrWb3z2ZXoRqkP8fvcu 38dMDcJZvcxijLG9LcFgU6/he/zRKE9Zh7E5vzQPsFpU826Qbem9XkyRaDhPLeSMRHQ+ Jg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m40y3yddv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:58 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2ATL9k2P019333; Tue, 29 Nov 2022 22:50:56 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m398eax7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdaLa6CSEk2e2HLe4/TM6bUloAqoO/Vz3Y2sK1vlKj4WGmAfk0feavCxR6DC1aCpUF3kuuxlpBVH91rqEitz7k31yk1LtzAEWTiKCxWLc7B5uicqZYDAFoJG91wzgQELZuQm7DRXD6dpLCc/C0vsqYAfisuJWqHjf9LxdBxCSE+q3L1OXD/zWceXar7DjiX1YNgxj3ZeV7UwZ8YNhG0wVBUEvyjAZRZYTmF0vNcISLNk4yJmn6PHe5Xh4/FG19jxULAPRpj/oimTtJ0zPIgLD+UdsB2aBRzGP1RpqwDkErL2vK+uTdcsBgnZ24GC8joDu+2OGaSLuRhBlUlZygxydg== 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=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=ZNcKaLc5Ze9QaVVVSxa8PSHW9Ir+9hHw6BzrTivljrhrtskYBqhjyGE813rX4IusUQXiTMWabVQKqkMQEMYH+RaTcxce+YsT+d0KK8ktny9RIid9N0krvPsxOMOgISV0FKwi3NsRc7P1JbFBvjKwaRS/X409AqK9ZmqwNGktay1b6KFHi2tj3iHlwrEuwWnFdMj697N49hN7x+AKUj3n+WGk8VLG87PSiKBNGnz/OdRDvvAJPyIaDwFctTGXyuxMacLXeWfh1mO1x7MNu1RpF6/oVIVdlnXm+8caf0Z8EYDWlaazbEwlESnjZ9CJnkBFc1HMqAtKFJC/hAIvW53srw== 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=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=mmU3WTqaxSvSDSsUwNFrFT6Y5TE1/A1eRQGVgh5vEfSKMwomCrI84wqmGS6tjE1BCOv2j0czUccaXCspiuirgax5A4HFe6rHbwj53XRDoS78YTswOep78DHbLZXoDbfPJyphWR+eLjvheK3yq/P9xnCkhkTDPA7XcVIXnweu7bA= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:54 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:54 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 08/10] mm/hugetlb: convert free_gigantic_page() to folios Date: Tue, 29 Nov 2022 14:50:37 -0800 Message-Id: <20221129225039.82257-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR15CA0022.namprd15.prod.outlook.com (2603:10b6:610:51::32) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 02b3d9ad-0e28-4aad-49f1-08dad25c2bbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SxxuUHRt4+B/KHMko0C/zo3Sq2M1RkjR+7W3eNBa/k+7fWKZNlB/u1dbAoLWSa9YJ6Nzk/3Dg93wdYIVjUwFblvAvjw/EEljQx9q/fKhBvT+QOKBfdQmBD9WjsOouDJ2Xs8UOs7XphO4djOrDmQyZ7d3vTFazTIR3cjjTczWFx8haqhmN1jr9ICRMtTaDKkxLWD258W8a4dgRscwXlwky1rvJ/s9Au6q+rZ385X7+56AgnvPZTUZzOr5wHFS3NrREte+qqtBF8VHxV1kOIyc8zR8lL7j/p0JmbqQgbpLmUxYO47oqLZzeSo4j5YX6f8b17Bfe2BLKkzcbReMKRdTIyecR02+RzqYcUliqd06c9eCF6ho3NcI4trgyNN4/qzE2UR/smZZ2vd+oO3GPbKE2vApVfOInCAh42bHCMtfkw9lAd4D7lbEWrNSMMGg5lzIKPbMKIqUcI7NDFnrw48Ukz1gE0GuxMX/J941U0SGgax49hM9YqFRwKRbMELoxaR7WDk4v73OfpajDc+ykS2nWiVjaFp+28l2Lf6lhnNf3WKFfXNrY+SC6DVphfVwOrEtzqIntcbxtlRi9k4mCJnsvTLbZDtII0n+c7JSufxDBExajFgZKZiplwKmg4y8T/cEmpI/rTmm0ufaukI45lo11g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bwR681NMFRJ4/akGQMeZ//uWJAXAGxSGfZGHGv8zU8vHTIX/llrYhciG79OHLTJsUnR011JUsV/TYGdpVS0FeAreAKhSz3elmsB/b1MwR7UJg0+7bsA2dIPvRDTxjIiDa7ZMhYdhDsSQhElkmPH61TZeMyohMUWje9KHbqDQuKzRi3V9deBxPghYrrdvAz73SDt2nleiw/6EuOjEZIMD75UcWXriqNHT9tURrt6e2kGGKT/xyU6orC47awKbCwFzA11FWB1AQPvm+NJyOsJ+pZdTWqZdI5RhU/gCKxZV6KphvlkRxy76KfXPxYff1utU/pP2AlqQtMIY81xXVM3MPBebgZgDcSoq8tw0aAjH7/Q6AitFf/6hM3ASyBqVE/xxnc6saKD4xt4fo/s6mRyrlJM++0X0o5raLQkIo8v9XERn3hLNlw/KFaP/y3aGT9w7EwHrN2ju/+8aaXCDlelmg3worwFCA84ETCYcKC6MtRTJ5O1aqV9u5OjsHsuQmUZHH/Ld/aBz+fpMyXctmjKU/UGH1H9z/qm5NU3Gyy9r3RBcaid6qxdlaMZiLpwS9odG3RzNHqrn++IL5gQ58r1LC59x70tb22oXoYf+WYzc7/STW73Zf7i+DkrfQb8vrcGUX5Vc5kz+D/hiGOpSEQBYKTWPvNX+io8SrjHhQmpdneOW0gtC5BRMAIgmcnBmYB6hBTeLdxFXVQx+pXqi9V0tmARbcohxXyuN2HghtntLZpNZgk3TxOGQlS5kF4BgkTx7+goKsmoe8XvEgBzF0ulnMPWFgtpQKwT9HpD3opefZp0FM7t4mzJfeGkCFQLrswcvJLpNnn1Vhppfz48buITyZ319yoM7vzUMO5mk6BkDNZ6JNDQf89x/+cKMhLl+iwRZ7X3z6Vo4bKnNi1NduGwtP1bn66qW/zfsw4ANd/p7yt0M9NmbOdMRdRh8Abf7fG4Ga//cVPt18olyp0aSP8UnsTr1H7d5e+YTP3SApRwnQKRmq8BmjDYPRInNj8NbEADiPw8QBVQjotQiHg49WOQVZNvJrYOnq6iRIl+hUIirsJtZv82o+AKgEG8nhUfjBFwhgQi2G82EQBrgbMeLwPlE2r5xvoAd8Okwv/8P65gf8140widz1jLeD1icIrZYbtqRwESKwIFEAwURJeixOgXxLFlBBu/5+f5KoV1oD/LxSJHPFNt9+DpfKc+sSsth+hlJ4UymK28d654sVlw+sFElWUZOcEKSzSPGUfmGEpd38fkXm8OBYHQSwYMFRfF0uiZs1SewCLZEXFyGlHnodBxF5nyL+JkI41QDxqevzE0b1lW4rMagEGUJpBg/5II98caaLSll6Eulsn9FTPpw0oej1TS54VUsMc/lzGy30sB9CSKVsX0X4uAEjfNU6SKlO45aXsiiI5FP2nWNvgDV2Oow2c2Bcp3DpDDSEIiOZ3ojKUu7Xv0VYUTVo+sMpuuuThHjCCRbOnCYohVwSA2/bAZ52O5ZHRvl/u3yrntpoaz2Many7kVk/iEHTEPNNJ9Sj3ByGp0nSHGOZjKZ1GG6L88cE5ypTNMjQvwl2Odt8cBmI6gnvLKQrCofffxSuQIyiJj/R0dFp5b9WdFtNnqWbJ2lOQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ZY69ynzMqolXsszWV0KgH15dUkDP5ahmvkQ1oDrvT/HpADt2gmGkAmJNSqvkPeKN0cAlIm4K05ydg788ieP3rHuqD5Z0lqR8RxaMUaGdzA3eITllR/oEMOFdcWkQfRMuMQIsr/+FmGxqntatToVf+7GKNHUAuwBSvmy3lb2SNccSqAxvFc3+of+SpkP1cfPlvbhfMaM1Ov6bANuThJTGuGRNeH3lsxXtILmPw0NpFV6GIMB9r5E+Lf84BsgYiRR8IaeG7LP+FsvsxBSgKYxoZ9s04ygtRieIxjrNl0vv6RoiSHDCHig4c7690bgjs2kRxjT2lCEU3J7xBrZw5Un6VDdc5xK4deeCz/BoNpOOd/JqUE5mNdbAo3yAX6q5/4ck1nuLZpR8vIuVjYCxgeY0DEhKfCMN3OGIv6UWK3Csvjo3ErLUY6feyb49qyaCL2c70xgS6As8xSJfcx1r2q3MUtUX58YnpvwLjGCIMt2RIF82GqfTbKFaqDalHXTb0hJQlZSg+N2zsycpjaAchg/FJtNUzM2XNMhFiCQzGFNKMSqti9G4X0HISEGDlvaNKNWTMG5c79YIe+PQRCJX5etV8H8MBjnkOG4LPCqaNX/j6291++CNv6SYosvxDbkNRmxr1yDWAcAGA8CVDUFGNqE04i2u8SN0mqCd036eNk3QiEo9+J6E6iZiA6jLCAIO/NqrLOopEdXhrFaiBjiRQKDADvFZITGFVOJXFjuSqiRipq2OjdxsroOllG0ob/Xr2vYUoN29p5RsGVvKZJBiu/jHweQYqckRsvBS1YxbiyxpkUGUdumCVLb/s04L5tTdV1qQaw4M6VM61XCvE8ns3s6niaFkmKOUrwUVTeKxGVWHlWLljEmb4msc6t8cIMeeV5lsxoOdT+hNN7JY2lXoqylLKbzUC3fa4bM8jlKg2jtvu53RFZ9dXD7HI/ttQ4Zh6prxYlYXPjqAH8+LPt9TiV6JMM+4ivX6CsZBrCFH3nMgjFIEufxDf4GNs7uv2G29cFGmezruVfMJ/Wg2Je5ZVbYsX7EUD+5u4oWGjemkg1GL5jUq51Nfl+gU/DBvuP1vRpqm947fsV0pxexi6jw/yRDECvG7eM5BgYIP23XITDgk9JM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02b3d9ad-0e28-4aad-49f1-08dad25c2bbc X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:54.4417 (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: HhXLrsLiKFd0IuWiYi3NTDIAct07rfrBhSEENQw9paVwimf/wKSCMITkdZO8BEObWJt2zkSPGVj1+ruNfKt/YORBFTC9b7lPl/iVDEnEDXk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: LyypGqLyMKerSw-r-tHOcNGzAUezfYBZ X-Proofpoint-ORIG-GUID: LyypGqLyMKerSw-r-tHOcNGzAUezfYBZ ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762267; 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=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=TBZNOOYVYPHSKOqtMkkpmbXQCT2neqf4aHn1uXuXUb0E3vs5sd8P7NdPRg1ferapuankji sxMg/JUxU2fiCMW6g8zqb4xFKpDIMLzXEfeiGzLb1EBEFfSNSwJ725komZ1dEgwQlrrJGj qqETgf+yQb7+ExqrcsUfqNHIojFWwf0= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=rdUq6asB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mmU3WTqa; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762267; a=rsa-sha256; cv=pass; b=7jwsRPDZnrgN1OSHAJhI1DBLz9I7WBZ89HAFGGuNNs43L7ks+t+nwrA5VO8qOSilhZ7cZ3 ACEpquysBhw2NOrxuFSJ/ouLBNzwQCoNx0o3GrwwkW5VxrsiHgk5FJeOXq0Gm6rW3GJ4WX WTTuohDVjOkCBgDq66/CFI6+Na2XV1U= X-Stat-Signature: rcio5fbi1snxhk3a8kbnabow3ixs9iq3 X-Rspamd-Queue-Id: B736C160008 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=rdUq6asB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mmU3WTqa; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1669762267-961194 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: Convert callers of free_gigantic_page() to use folios, function is then renamed to free_gigantic_folio(). Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index c889593d5053..5e580ab834c3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1361,18 +1361,20 @@ static void destroy_compound_gigantic_folio(struct folio *folio, __destroy_compound_gigantic_folio(folio, order, false); } -static void free_gigantic_page(struct page *page, unsigned int order) +static void free_gigantic_folio(struct folio *folio, unsigned int order) { /* * If the page isn't allocated using the cma allocator, * cma_release() returns false. */ #ifdef CONFIG_CMA - if (cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)) + int nid = folio_nid(folio); + + if (cma_release(hugetlb_cma[nid], &folio->page, 1 << order)) return; #endif - free_contig_range(page_to_pfn(page), 1 << order); + free_contig_range(folio_pfn(folio), 1 << order); } #ifdef CONFIG_CONTIG_ALLOC @@ -1426,7 +1428,8 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, { return NULL; } -static inline void free_gigantic_page(struct page *page, unsigned int order) { } +static inline void free_gigantic_folio(struct folio *folio, + unsigned int order) { } static inline void destroy_compound_gigantic_folio(struct folio *folio, unsigned int order) { } #endif @@ -1565,7 +1568,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * If we don't know which subpages are hwpoisoned, we can't free * the hugepage, so it's leaked intentionally. */ - if (HPageRawHwpUnreliable(page)) + if (folio_test_hugetlb_raw_hwp_unreliable(folio)) return; if (hugetlb_vmemmap_restore(h, page)) { @@ -1575,7 +1578,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * page and put the page back on the hugetlb free list and treat * as a surplus page. */ - add_hugetlb_folio(h, page_folio(page), true); + add_hugetlb_folio(h, folio, true); spin_unlock_irq(&hugetlb_lock); return; } @@ -1588,7 +1591,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) hugetlb_clear_page_hwpoison(&folio->page); for (i = 0; i < pages_per_huge_page(h); i++) { - subpage = nth_page(page, i); + subpage = folio_page(folio, i); subpage->flags &= ~(1 << PG_locked | 1 << PG_error | 1 << PG_referenced | 1 << PG_dirty | 1 << PG_active | 1 << PG_private | @@ -1597,12 +1600,12 @@ static void __update_and_free_page(struct hstate *h, struct page *page) /* * Non-gigantic pages demoted from CMA allocated gigantic pages - * need to be given back to CMA in free_gigantic_page. + * need to be given back to CMA in free_gigantic_folio. */ if (hstate_is_gigantic(h) || hugetlb_cma_folio(folio, huge_page_order(h))) { destroy_compound_gigantic_folio(folio, huge_page_order(h)); - free_gigantic_page(page, huge_page_order(h)); + free_gigantic_folio(folio, huge_page_order(h)); } else { __free_pages(page, huge_page_order(h)); } @@ -2025,6 +2028,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, nodemask_t *node_alloc_noretry) { struct page *page; + struct folio *folio; bool retry = false; retry: @@ -2035,14 +2039,14 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, nid, nmask, node_alloc_noretry); if (!page) return NULL; - + folio = page_folio(page); if (hstate_is_gigantic(h)) { if (!prep_compound_gigantic_page(page, huge_page_order(h))) { /* * Rare failure to convert pages to compound page. * Free pages and try again - ONCE! */ - free_gigantic_page(page, huge_page_order(h)); + free_gigantic_folio(folio, huge_page_order(h)); if (!retry) { retry = true; goto retry; @@ -3050,6 +3054,7 @@ static void __init gather_bootmem_prealloc(void) list_for_each_entry(m, &huge_boot_pages, list) { struct page *page = virt_to_page(m); + struct folio *folio = page_folio(page); struct hstate *h = m->hstate; VM_BUG_ON(!hstate_is_gigantic(h)); @@ -3060,7 +3065,7 @@ static void __init gather_bootmem_prealloc(void) free_huge_page(page); /* add to the hugepage allocator */ } else { /* VERY unlikely inflated ref count on a tail page */ - free_gigantic_page(page, huge_page_order(h)); + free_gigantic_folio(folio, huge_page_order(h)); } /*