From patchwork Tue Nov 29 22:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059287 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 05A3AC433FE for ; Tue, 29 Nov 2022 22:51:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F5196B007E; Tue, 29 Nov 2022 17:51:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 97F886B0083; Tue, 29 Nov 2022 17:51:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 735F86B0082; Tue, 29 Nov 2022 17:51:12 -0500 (EST) 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 5F0BD6B007E for ; Tue, 29 Nov 2022 17:51:12 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2BF1FC0A45 for ; Tue, 29 Nov 2022 22:51:12 +0000 (UTC) X-FDA: 80187977184.19.CCF3B9C Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf01.hostedemail.com (Postfix) with ESMTP id 6D8464000E for ; Tue, 29 Nov 2022 22:51:08 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATMEBlq020338; Tue, 29 Nov 2022 22:50:59 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=wuU7XVHLL/UaHs+sBKQj7hY4L3mCo1hC7zE6ApTPLx7Jpp8D1ZLJ/+ESKM8Wbt4WpFNy J8egZH2I3UFNZgNVnCjymV1oU4zZkqIb2aIaHGZn7N5CV4BAlYA0MM45L0H9U1lTrSJN 0UHnin+P5gRU+BLj5JGU2UD6X6aSWQiF3ceYcVGdROYCIhPaqJWcn5coQB9UBML64KY3 zA+kQMpmTfwuaXV7rQxbEgL2zl1oTH6fPRkaWGQhrtTZ25D8AF9wOK2jSNv9jE5ReyjW n5UcZemxNt18KGEtJ0QV/wMG7c2AolxjfXqwbMvAtQOM89xX+vxbPUXb3bpqVyu6maKI fA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m3xht7m22-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 2ATL9k2Q019333; Tue, 29 Nov 2022 22:50:57 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-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUU4x2mtmGUjc/4mmNN1YX52GDjamaXusDYCBH+UynivFZdev9PuQlb7JG2InxWQ1FeKSFsqTGL3KsF8LVFRVHH5NZ8xebw+7/pVNnbVpYDfNoFWlswS7SNAU5V27W1NStF+P9TJjIH1SDBnQxgTLA542G/vtmS04Gjn5IQ0a46iQzQ4eMCYN3IzZjbHT2qU6x8L4NMQAWLuFU6TMrgEZ8Gfg7M+uKfLg+VoBi5kJWat8+oCXSBc3CGuzoIprb486+BTb5HZUsDKjtlrYtVqDokXYoUABS1iJmXArz+X1CmM6mLJvucbdkBGQ6FsuZ/zRHUDpDSrkkogFN+OtUrQ4g== 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=RMN8IBxfBLNqVeLSXdG6CfCIpIjBd0/sMl/9GtOohx+TiYKEku5jUzF+RLY1notO3iuG1EEkYqTQdBY62IXY97mB5+jWHeU0c/OD3rPfNR6YWsFoOMPtyHtQLy5I6CJzeX+hYLeIMf8Z8EN8Ym/KVGiVXVjh3x0Dc2YgKnd4Fi7tGiL/qrTxVQzz6+yCIEXwgdlk9ADyV/2egQcNcQ/KivSVFJIPAbXXWvjn9MVij4eCirtRtNyh/Ar9f5sC+QvT5cN6Bql+57OZxgIJtfONj32evMp2BG3yPoYjOjpk0ShxaIpGd0K5trRc5zD0t93V3ptRM6eBWYaGE/WqRtgtrA== 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=YB6v5qE6JKhxDEcxHrZY85+ErjUMHuWzAm7uu5ug1yQyF83fqLIrCF4Tl4xm3v7XtZjCarZ/YGEd8uDcNP3HlY8GzJdfHsc+aNNB19BsyDYQsQilMXqRqJSzFCoWIOajN6FvvwPuf3hcnCOdkjNqvoflSc2rpj6+yjVMg44fdW8= 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:55 +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:55 +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 09/10] mm/hugetlb: convert hugetlb prep functions to folios Date: Tue, 29 Nov 2022 14:50:38 -0800 Message-Id: <20221129225039.82257-10-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: CH0PR13CA0008.namprd13.prod.outlook.com (2603:10b6:610:b1::13) 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: 5d2240a9-8a8d-462c-fed5-08dad25c2cd7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 47H7Lo1fuqQNtpWt8KB+w0mfT7vdYbwbMypp2NufQjCnJwlgICkjAlxxJW3KbIq6IOfNoyJf2hjXLdp1plun3mETbw5fEKMRFqDCE9sq7rLP3ZTYZYPLAgvvtmIAl2UNCXVouKgUOwwftibwFymmVWgDX3FgI8PR4h7TJFEW+eXgHc0VXvCwSLjeTMmLLjjvoBzBaD1nz/reHpwOUBleZCCvG2ZCG87j9hDkgyNtlbIUQFEvMbgr+2x3KuWYQeMeiR1FcWZ4b+toOJjfjUZMXVA0VWZu/w7LcN4QwoGnalihUOpkzD5b7d8bRDIZ+TtqOnH1zHrKG4nj0IvKfTf64ZXjDLVVbNRdl77BPeHQUfwo2ZIlMJXuaoejMRBXShC1GclIWx6gFEAJxLgRcPcTIfQ/qqbCc3b9y3dLsFDwtxGW8hA+3thMMw+/mu95RlQGS9Ob9yuYnnDypPhPu9gFvS0tUktsW+XS+COFCHkXTYfPjA75iyLjcUHU1P0rslAIiA61vYBqsAnm34RIv1FfY+q+THMUYJbGgdqVUlY1EVaMjwjkMMF7H/gERzQgr3ZPSQ6EeTGeOtrcU5PeSa44NrO3xju32VgM7XePztWKLGrS/FwfkjYrgv9TAZyZl9nXm11qMP2GxRRwy7DoVIx5LA== 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: eVl0Y/6s3rILMlkNq6kOSZsjbnnKWcz77ZWDuIQYqAGuL+/GEqHJCGuzq7+xdL7G8fSzVuo3T6Ci7oZh9PbvIaI8gg5GKAKms/PSIUX5h1bTSebc/UjZPqrYnCBNPl5CPPmJjA2ZoVNscMatdOpZpmAVNO4rQU2NIuvIhn65gxAvUZpDdhjqrUZ5NrKgYJ9mmSPmSKVaG7nQ5aNYhlOU+Q5sxDH3AFuw8XGgwXb2O/ATXk9FgtTLzss2mRYqHKfM5kb7PProNftYrQE6VmSDmnA+WYBqhJOdS97PZf/KYHkcc03YDozvIOtQPgKJpqfM/ZIyO/qQkiszPCGkkC3m4O3kYBVDNAancexwQaIQgRH8dwdXSPxPXybi3uVujw3fEMeSUi+Nf0ssL8VryxtzBoZvnALd3ZETX6ZasLgUaSmAVVvWayP4ghmihcDDErLdObv16l6FRB/yke4xJaZ5Qa+QO56jTxeTWS8LqRF1wjyC/pMgftPkpmRxjH5bSp4ux8fIcTedHELHw3SQzEfNuRkl8wxIFT2d33QTfu3YKTnHLN+Dgo5gkgKqSKUWDU8DoQmo9TE8fJXw4aSfxLREnH8P0wtxgn75ETWrIG8B9+abIjXp26dnnhZS1k1u3cSw2quJ2IBm98txOHra6e2JRN80DRc3uWBF9Nn/ijUnYBLvkc/E71qWCCwjJQZtQqbPTP5vBDayfyc0wwROsXJbR2pkcF7vft8BIwtiYyDK6aLhbJCxMLuHW8mCUqyO2FVyXMZAFpPsOA0yZJ/QODZHO8UcjjFgYE4fuO1iZ6Puc9wKUdLNTdfpwbs7I75qzVS9xNfrNIfj7eP2DzwCnZ6qC13GlShCDnNn3k5cNL78EHsck9FKWFI8L91vAY4UGi0KlJ9DMcXOkTx7RrPXGUEDap6PT9O0fHv9SdJ2aeJFgpjwG1iKi+k9MhJyflsg5oOdEdND9V/oK1HYsxmSPLogbj/CAZXAy+TrryjYJgLLaEnQCDmRFhjNBHSBOWpTYgRSNNaO4UxHvnjHvK/tBwwDd0sQ6rK9vsCrgtAh1cNW4ZEBBADIi9XVXgVr+K8rlBwx0ROjS7kQkFlj7xNQV0jNxDK3VRpWqXXZIzO3zETKONY1pUYpSNCKSL89TCiC9XQrVUH7x+7u9C3xPwjqqY3LU05JXhY4BbrLe6gU/aKQpKaci8SItqeFV/oC9a4c/Xe2/ExVEY22wPFuWGsPOduKUD5U656Y6z2xQIUTXui2kaWHTkhxJ/bjDqC2Ks5L/lzpRujCklBmzqQYI9hbTbG4U0ew534AGnEm+zhoO8N9JkotX/ADaxb86ayMvXge+svxsIopzwNLCjG6f1Wh5cQNplx1+Zdj/AGVEtjZHwcbO76DBHv7BuSSLUkIFN7ffF4y/sAOrO78+HdjhoGpFmtVOs3m9KSPG2Scehck2RmAs86ubpaYtyiLAJgQQW3y+ynBK1M5ILbh9mQoBqdI9PIEv1Zr665wJXNlTZ5mXru/iZk2ZKfEFiY0REJ23NXyvOXivh1D+bVKSQQYMZgtO16ZtjsWMIDTRyvDpwsGf8SP1wV95UmZBGtCm9T9lXeJCpS9jctNEKBWaHIPf5EqBpBLyg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4+7lavjsVlt939rQC6uCv63vmUlXEd3r74uJSnPiD5jEDcdOhSqauS7vX0JEphMQzy0/uT63ihigeCP5lIc4aKk683JHiQ2rrmR6v6EZ91KfCFkWBtM8b5BU1gsNtIIZEtb3GQqSSHa6fbgMtqGr2/ajj2rlDtcfze0di45IaAFHwHPHDpguuteGC0nnIavNncy0J1GFEPV/XGICxaXsM+ecdZVRkOfOiE0F0WzS6rmw99VuNQL0MnJ2wkVkYavfabt5fNEGdctsMiwL3xLKNYbAjjp4Uz4LyxsQUQbJKnzzkAcBLeMaUFlcK+JuvWoLPSz1eteGe5GwGlItCVTB3rQEiBAwqWzf8YStX/9Lh8vDNhWIfVxnk3Pzrz77969qv2/oFTZtuR6AgyEmpsHMogLycQaiUe4bCE0gz6GbKS7x0ypD7FFuwVKAB8r6klULKlKJwHOqo5lN1+JJzfArKQYyIayFxouLmLFYZwQnOBJu+VCHsm2mgMV+EbCQPNUO5c85mYnCFQfRik6u3Loey5gcviMeNrG73qFk9NiVa+MtxVzHHuyjBrse0FskXwQb6BXS+3YZQp4rLirApgKuYkQa6OWe8+XGbuX+GdAbDLVnlQ+pXD5VJ/mOfIAlBXoIxxXS2nsNn8eveG5eLm+L8cBEaKa+j3ej4odMYH3M/wzeWyHi6m5j+JxJ+WHqhfC2kET/SQwhJRZF5fDYkE/IG949oq+7Af53RJYgDnhIuNBNATm38ltsRQR3o1EJhfCgqGOQni97VZcYR3qJocgySoQhVRbxictR0nm5aFfUtQmozHoAeTPgqCYuhbf/KURSi+xfAENICjZV+ns7IvrWXvfHFmLve/4ybMHIt2NUvv/ASgDAgaowUs5KyP8IiHqWoNDdLUopQ7/wWkQ80Jfmy6bGVPI2lrTEZL6UMC5TK2UcBL45DQ8I3v7ANpJwSxp7IhcMzZG4vJz6geGRxluCLvyQx0ho6BBva2g+WToTG3AnxcNELnLa7ajIHVTAwh9MgNopV222QjU8NUDYKpt+xh9504lVLMRtLSGvpf606KnUbKGuGDGniwVHv6tcpfWZI5eQmCuUvJyVaW5JQUez+uVd0Q+ivRv6HCaGJhe4Fe4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d2240a9-8a8d-462c-fed5-08dad25c2cd7 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:55.8305 (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: bIUHTmcF5aJwYibkvhqX27rRYWxoSH7Dpk9KPC1j8ilSqqzKQPSvISenqi1ox9d+W5vxdZ1PtSS4AiBsOSIe6wRaqgOtCBKie1QikT4XfEY= 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: KKwCzWtllePi_eY3CNfopvafwq8qpcKh X-Proofpoint-ORIG-GUID: KKwCzWtllePi_eY3CNfopvafwq8qpcKh ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762268; a=rsa-sha256; cv=pass; b=Vyy07/atMB9WcolAoh9nhmfFHRhUQP4X1nf7BOgwLJq9AsIF/WTja8RduIVxNeWROVDL1/ 32gdfHB/xoj+cb+obzfE4uKLvRLEnNWeu3lQKGhrl3zQAVLvwxUdzBEbKzjQkfVbWCJdJm ci2B56nIq8BKLmmX6ZmZkwTfnJCtgO8= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=wuU7XVHL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YB6v5qE6; spf=pass (imf01.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=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762268; 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=av78Har9e58IkiZXTYZMzXgF9jOSzCMzNUrWhyUeL0qzKP6yCBkLMERaHnkqr3QvR1lWcs I66l+1vPReb1lbFiMQC5mh9s5zYxiBXf4ie7ib0suHuI3gCSN3Hth8dHlMp+BQJfzT3MJx 1Jhm8iCJrDp7jWS7prQJUyzvh/X0/Ts= X-Stat-Signature: r3sp51xk181or7oxri11toaspanmpnqz X-Rspamd-Queue-Id: 6D8464000E X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=wuU7XVHL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YB6v5qE6; spf=pass (imf01.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=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam05 X-HE-Tag: 1669762268-956462 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 prep_new_huge_page() and __prep_compound_gigantic_page() to folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 63 +++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5e580ab834c3..f61b4eb58cde 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1789,29 +1789,27 @@ static void __prep_new_hugetlb_folio(struct hstate *h, struct folio *folio) set_hugetlb_cgroup_rsvd(folio, NULL); } -static void prep_new_huge_page(struct hstate *h, struct page *page, int nid) +static void prep_new_hugetlb_folio(struct hstate *h, struct folio *folio, int nid) { - struct folio *folio = page_folio(page); - __prep_new_hugetlb_folio(h, folio); spin_lock_irq(&hugetlb_lock); __prep_account_new_huge_page(h, nid); spin_unlock_irq(&hugetlb_lock); } -static bool __prep_compound_gigantic_page(struct page *page, unsigned int order, - bool demote) +static bool __prep_compound_gigantic_folio(struct folio *folio, + unsigned int order, bool demote) { int i, j; int nr_pages = 1 << order; struct page *p; - /* we rely on prep_new_huge_page to set the destructor */ - set_compound_order(page, order); - __ClearPageReserved(page); - __SetPageHead(page); + /* we rely on prep_new_hugetlb_folio to set the destructor */ + folio_set_compound_order(folio, order); + __folio_clear_reserved(folio); + __folio_set_head(folio); for (i = 0; i < nr_pages; i++) { - p = nth_page(page, i); + p = folio_page(folio, i); /* * For gigantic hugepages allocated through bootmem at @@ -1853,43 +1851,41 @@ static bool __prep_compound_gigantic_page(struct page *page, unsigned int order, VM_BUG_ON_PAGE(page_count(p), p); } if (i != 0) - set_compound_head(p, page); + set_compound_head(p, &folio->page); } - atomic_set(compound_mapcount_ptr(page), -1); - atomic_set(subpages_mapcount_ptr(page), 0); - atomic_set(compound_pincount_ptr(page), 0); + atomic_set(folio_mapcount_ptr(folio), -1); + atomic_set(folio_subpages_mapcount_ptr(folio), 0); + atomic_set(folio_pincount_ptr(folio), 0); return true; out_error: /* undo page modifications made above */ for (j = 0; j < i; j++) { - p = nth_page(page, j); + p = folio_page(folio, j); if (j != 0) clear_compound_head(p); set_page_refcounted(p); } /* need to clear PG_reserved on remaining tail pages */ for (; j < nr_pages; j++) { - p = nth_page(page, j); + p = folio_page(folio, j); __ClearPageReserved(p); } - set_compound_order(page, 0); -#ifdef CONFIG_64BIT - page[1].compound_nr = 0; -#endif - __ClearPageHead(page); + folio_set_compound_order(folio, 0); + __folio_clear_head(folio); return false; } -static bool prep_compound_gigantic_page(struct page *page, unsigned int order) +static bool prep_compound_gigantic_folio(struct folio *folio, + unsigned int order) { - return __prep_compound_gigantic_page(page, order, false); + return __prep_compound_gigantic_folio(folio, order, false); } -static bool prep_compound_gigantic_page_for_demote(struct page *page, +static bool prep_compound_gigantic_folio_for_demote(struct folio *folio, unsigned int order) { - return __prep_compound_gigantic_page(page, order, true); + return __prep_compound_gigantic_folio(folio, order, true); } /* @@ -2041,7 +2037,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, return NULL; folio = page_folio(page); if (hstate_is_gigantic(h)) { - if (!prep_compound_gigantic_page(page, huge_page_order(h))) { + if (!prep_compound_gigantic_folio(folio, huge_page_order(h))) { /* * Rare failure to convert pages to compound page. * Free pages and try again - ONCE! @@ -2054,7 +2050,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, return NULL; } } - prep_new_huge_page(h, page, page_to_nid(page)); + prep_new_hugetlb_folio(h, folio, folio_nid(folio)); return page; } @@ -3058,10 +3054,10 @@ static void __init gather_bootmem_prealloc(void) struct hstate *h = m->hstate; VM_BUG_ON(!hstate_is_gigantic(h)); - WARN_ON(page_count(page) != 1); - if (prep_compound_gigantic_page(page, huge_page_order(h))) { - WARN_ON(PageReserved(page)); - prep_new_huge_page(h, page, page_to_nid(page)); + WARN_ON(folio_ref_count(folio) != 1); + if (prep_compound_gigantic_folio(folio, huge_page_order(h))) { + WARN_ON(folio_test_reserved(folio)); + prep_new_hugetlb_folio(h, folio, folio_nid(folio)); free_huge_page(page); /* add to the hugepage allocator */ } else { /* VERY unlikely inflated ref count on a tail page */ @@ -3480,13 +3476,14 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) for (i = 0; i < pages_per_huge_page(h); i += pages_per_huge_page(target_hstate)) { subpage = nth_page(page, i); + folio = page_folio(subpage); if (hstate_is_gigantic(target_hstate)) - prep_compound_gigantic_page_for_demote(subpage, + prep_compound_gigantic_folio_for_demote(folio, target_hstate->order); else prep_compound_page(subpage, target_hstate->order); set_page_private(subpage, 0); - prep_new_huge_page(target_hstate, subpage, nid); + prep_new_hugetlb_folio(target_hstate, folio, nid); free_huge_page(subpage); } mutex_unlock(&target_hstate->resize_lock);