From patchwork Fri Jan 13 22:30:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13101714 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 665EEC3DA78 for ; Fri, 13 Jan 2023 23:01:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C591D8E0003; Fri, 13 Jan 2023 18:01:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE29D8E0001; Fri, 13 Jan 2023 18:01:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E5CB8E0003; Fri, 13 Jan 2023 18:01:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 87D488E0001 for ; Fri, 13 Jan 2023 18:01:51 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 56D831204AA for ; Fri, 13 Jan 2023 23:01:51 +0000 (UTC) X-FDA: 80351300022.13.759950F Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf20.hostedemail.com (Postfix) with ESMTP id 16D291C001C for ; Fri, 13 Jan 2023 23:01:47 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=anG2gdXM; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jPCUEOWx; spf=pass (imf20.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@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=1673650908; 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=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=xzyt/lYAX2rhdoz+PeJ03f/SxEi+dceKw+2HJSmg0ane9IhgDSYIXN1oydrZ9sHQxFVBdx DLInDLfpnRaToqaosKGC4BPX6XCqpSx5xzbacFB9QucbOi72+v6TZ8thMNe1PIwXDStxPP GUXopQTUPtzI/5aVju8cXEGI+7wLq/s= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=anG2gdXM; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jPCUEOWx; spf=pass (imf20.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@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=1673650908; a=rsa-sha256; cv=pass; b=EB7Vb202CpapOnciqxPAoHK2bILP8x91iKO1lF1A9Fyc7VEYDPc0a0TJm1CTF7gbSmfBlV shXGeCAdiZMmPQgvg/bJ/xWvscnbAo6nSKOKcRwOa/8Vn6GTgDFDfX6CrY9VEb4jnD5qJe I/c33xK8k0j7hLhpwo4AhFvxSOyetYA= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DMpBYp008226; Fri, 13 Jan 2023 23:01:34 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=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=anG2gdXMW7cw6oPWnrP9UoMR4ncSrGYHV9H7CsvfqQHKVZbDPLWLfiOER/CT2oHvC3Ns cokkWacXbDtBUCg2zW3urVbppuzyFObyY8yUOIw6M1MfXQEAr+0OKM5ZgMYCsNkzIubN eilZvYafHxklzpvism0fJCxpnFQDxoCJAwrzA9ev/zmaNY4tyU33l/sb3rYV2+RHkTC/ 6dSK/XyNxWeRTKe5Pn5yyWcFSAoemVTrE0FhuAziAcL2DMMfOmHOKyhnuUBFGYEUqyse QJ1cRyX0DrTIkOMMqDpFNS8e0gSHzSwlEkJ2cc4U/LF+EL+4/7GPAE8GeOhUd7kQOy7P qA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3e0w0adh-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 23:01:33 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DLRUnl004403; Fri, 13 Jan 2023 22:31:12 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n3f7usqt7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jA7hJmk3W/fHax6ZoaehiIWRKW+1y1x48Eavc1xaC0Xaa9fAQ18IpUF7EWL+cQsMsws7Jp4uhofqb7JKLd4uI4XQeL0bpKTWfGRRm5+sIoIDxj+PXJ2ZLt8Xnaz74t5eHu4j0kYg0aRDWCQfzWSqjP6tRWiPx/mBeFphe3wBXXwHAEKzv5mqnL77q0SShj9MurfmwDZnF5tmXmnnabApYE4dijTUvlpD1yGqwnXZKkeJOswXNBL0+v4RMLuVtFNBdQgS0UohdkCOjatCyUyJ5F5Kzyc5xwI0+qPRPCgWQ7UJmXcmfYxd0H63MtbuHdZyVREagRhkn70pJpxZILjQfA== 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=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=kMcqHD2RDXSG84haPC/CevD3AgAfup5DTcvznQEMBlmMA8wmhfiizuCeW2E/MMkKN4rBWE7jLPyJfSR0G7RVndLxV/jQOeV8Rxx3zgUaVIXY3IetPTLb/kevGJueSByaPqUUN4wBaF3MCgCwLeE2CITcYljPLST5WCj6qx58uXyzhW7fWrT57D44OHByJY5Aaxmp9aShLKScKNxISg9T0NUN/X1T23xajnF+8qWAhhDlNTUKZvhuHRLyATO6Neu/v5YCDZNTx+sY02GHm937GK2Ow/EzOUViqjyR889pXt7piPdsWr9UZ/ah3zmPYa7j9kTAIx6iBkUIUq+WQLKi4Q== 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=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=jPCUEOWx3QM/CeQAUyg5Cwk926fAKdqFSUI3woPtJfJJswW8XN+2dBil/GA62OLLem2AmfFMoKm683AUBHNlMiM/mIizpnFdcp7mDwB+mBhcp9aahYq6Ix1KqNlECg2hc7SUzsMGHg1ZtFtcgaBoK1ZTQF8nKircj/3WBPR/SMs= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:11 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:11 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 5/8] mm/hugetlb: increase use of folios in alloc_huge_page() Date: Fri, 13 Jan 2023 16:30:54 -0600 Message-Id: <20230113223057.173292-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR17CA0029.namprd17.prod.outlook.com (2603:10b6:610:53::39) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 3429cd2d-e3ec-4886-bf0d-08daf5b5df09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZLRF5rQAm9caLRK+zOZHkn+oiyr9zLq/BkMigmq2dNjNPOBW6x4+rofg3s5yDIgO8pK48OeoTgKxRfZIRrNE+8CQY/BgsVrSmUnf/wML4R3t8CLFomWqQopPHSsl8rowieO6LO9F7O3Rs5OZGfLJPRmtOBVTzJY0j/f28GfH2mLfVMzImqoa/lDQnG6BdY2GxAga2uiv2rCsLhANTupUY4r0n1veIQeK9jPrfXVoBRIKxl1Z0ckX7M0HUq8U0/XEghv/tQZ5Jr+O3qHoQQ5EVz4fS+q9eqgzJVOk2cxfLDEeXg/rAXthc+Vkr5lgOHpRAlEqssCt+PxogqZy4tZfGWDAU7Rq2pcHxnMiic830ZEyCoSNSLy90uezlI4S+6fMnz4JkctltwJp7sYpWklMkdDrKJi7vodO3uqKVcYKuPyojWoj/4FFnNrVYD/pKz2vHQUiaqq+MdJeib++kJunKryYjBAXjEGFcLRjiDMyb5T2tWB/cgFbL2Uda6CMUSLWPWD1o9HRGfYvWHGdsRxWHyK3ub3PQ6ssBEt4HmkDWg5cRvM7SgOBqt0zR1CHiAGhGp/E4fcQhnSOt1RRTm4j4oIRNEVda6bG0iR9ojA2uso7g5DhxOTzxqqF8XDeduMS80/gMyrwDpjtRbOUhwJp60GvHLvDCHQoxoUbQ8YG0UiMMrtB0KwfvHLRXuzF3oWa X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I7Zu4/edujXnc2bEX1bfYKj7hfVaHMNFpqpVbw3mGOT3d8KXalFeW+vsFFDOGc69zxT6Z5JaMqU18kjDSCK1aXJZTHfehq9lopNIDSg0iCI2lLSL5LBSYnqAqsbizzM47rJ6+NofNIGnoLUIl7F+fR7A/fZY+wkb2wps4A7qYNpAEBYesBMXjxwWF0u71Fiv49vKh2BHYTnR6d/UK5tngirkx5eigz0ap6hT4ABgSDrlDC8Sa37V8BGpv/FfHbyj2xLNej95JmS7YQW1SU0ViVKzZZW2JNwJL1nqhzWNXOwYj9rC2qaVPUmgg1nYYQxMii8eblCeSQAKotsFZt+X9km7Dzinzf2Me+qJBMtuajb5CSI0HF9bMzGmi1U47YQJBwrUxZ1zc/jb4jWQHHvdX+9FM0t5xID00M6YY4ytdvRpbS/EdlYwm3Qa86UIJGnv0QzW5uDwdCXkiWdZlz6ZKhHkucU5344k/TlKn8IVWuGbdPM+IyKopuS5/PXWbRgMkG6/QcguBmJm4IsTAms6nvoZSxgmKKOfbHsU92UK6KbWMSX6YCfyyqnvpbssLQpjc8z1P3e9DuCgKzJdSUb7atQDclSxAisnoZKStdG4K3V5yNOgFaJ1dr/UHIph03A5jgu1rAS2EPmzXahG4KEPKwgnC4XW/88q2lFI96L9n2RngNzoXC7BzZrVK9YFo8I2MLgUJKVCiQErw2w5U1V+9JmwHC2PkBDrDoiLFtlX84RNhdIsArL09KUaImx/R0m3DHhEzEGmBCGtuSYDDY2ak03t9zVbCIEBiOzpiwHL8b8JZgHxBp039Rtyu53yEPraWODkBxAiFjt+m+81L7XjPETGNBzbfimWr/mgIes5SKBhVnhTxSv/pdcu+mkWcBPk+lYZPuXhFBbM3yFjOx13Zy8UjCxbBc6u1xtSZwaGovXbNzemalSDxgR/xuyG+MGEilSAfrc4TxYMXxUxdQY+dsUKdnMjivIYhrmtsjoQNaenats1TL+4QCglTGy1OzX0k0C3lX/LfYJaVW8s3hDQ6VsqOiwpLaH+1lJR1vdTgiFX5CE5ZIxMHEwU6s3FBq8pa/SVhKATKgIIk6p5TiKbi4Ix+j4nzCVmxNPml8BktNlcPy2GG33MOUxGeUGMeRpUkMeuDBHNPl8H6GHV+8C0EiNmd85nxL0KtJd4gFuEFXKipMqEsIQpzn6dd7SyHaHKPpWFaYFdXOUCBRgvch/ucep9ZnGyg0JnJcmXqqlfikJL3HVnDATxvY7JGR/X2v6rWzeyHXZAAZWzV86Ub3UFrwyrhywWkgfnDu4s1h6h2ISlFXFJQH03SIIdvmkSAVP74zq7UYohcOc2GhcU3jSIFwlmvAtWVWwa9d/e9tmDEF6O+BUC4F9jtFHD5TB0+YUuoO/OnjYOalNnKaIZ7kSWikTQj0hEoD+s8egFPzN8KVSyLATROTHhPVW82B90EgjqKOjAuMgd3BOx0AlbhW2kmj/IU6NYoPSZ3c/hQgSCIyK7G0Y76K9hRMgs5abWx2u8FSBJnU+Nc99F+VcLCWnx2jrujkWuNIDXsrfGAQkEETIMyo0sOgZ7riRfkY7nmWcySsmBc44BxQCacUOtQOKT2w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5bTXZsdv/0k9zK+b71PKLHvIUn4COtqMzAuYVxEIq+O1+jwjo+okN4t+oFSyJxB62RRP2Ez7oYSjsaSCECTOtB6xnnGax6majKSNitR85FYVvEvINpxI72hezX2RRzvv2OdWtV3NKa9OGkzGuWQak16gXtZU2KcQaAjtBIwR10g+Me3L+9XVZRbbUsyUP9X5EB7iihPbM/5LQMtOa2h8bFO1hqXHkNxd4x4UwQPGJjfIYN/b5GVzm+/gzE2MkeLaDUuaN1WBlh1aLo1iQV0EnV6uJ2z8R34wQN12+T8jb5A2ZiH/HkHfeYdelLB3BayxZvgapf3F/sToEiTTvRWvJYO6lL+GAfO+G9fSd2zH3cBE78C9RFGFNRUnlBFOSHuFt7sy5OO6BnlN+1iopPTN5tFx2jrvCirnyAWRwVNRgZeA0ISzBDXumgZn03Z5rlXDRSDNNM6w31oMuHVV8/xPcXqWMlnzMUfYLuzgP4/8e5it90IicIDUTSW2snd1ydaHbiWmBMAd8uK/X+2yoIe/Axw9QXv0t02OZ9g+UPkM2CEkLQGMwaAo9o5mBQ9HYkyvKXEktPU40/IbBP1Mre4s1jTX8FgAoGvf6CugRazKnHP5drXoXtD9rtgkW9gK8Bsi1FzgH/bFBg+W6BXXy7H8zjF6Kl0llnnUCxPzSGDtiG9/+BJKCqPMXTyYhQ9a1CGQgefZXJw+CD3c5HE40beFWMN3cjFwKl+/uyX6mRaTX2NNImUILv5Vr4UiLF0VweGGDnpq5+ZZJ8kMFtUbGZ0omyFy8k/j+CNlpqfa4ekFC9UMeeHRcd917y/HCnfuzp+3KfS2zR+JX3mGrykW7/AgXR7p3pyKB1PfEkRPuJL5NepmyC1CtWrs5a9oUQAJxbgUIozjM9HIkx6w9IDJXsmdtM1Hz7SOO4veO1MkwSoSKnAzaD4OoFION1wODhxMlLBx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3429cd2d-e3ec-4886-bf0d-08daf5b5df09 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:10.9002 (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: hMue7lt5AlYJL4l/w8TZm1nBMO657m+94J/gx51D74k0d0MVD5IJlzRYEbROXjh923EHPPzV5hag2CwArAjBT+NJkZSlitnZ7yijwuHtpuA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-ORIG-GUID: 9jFQFCRsq-ngaknBfjWp_a2Dhaz2fNDD X-Proofpoint-GUID: 9jFQFCRsq-ngaknBfjWp_a2Dhaz2fNDD X-Rspamd-Queue-Id: 16D291C001C X-Stat-Signature: 7eh91b875aj63fo5rdkk7bmfmxkf5g59 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1673650907-147153 X-HE-Meta: U2FsdGVkX1+OJhSfaFfojSwBnQgwX4GlQQ8A0E+yWqWivxwt7W4xpZHTBxLyPLgZ+Rtfdy8hJoEbSz/HcQ8AFGYVfNlV2ucNfb3IGviy20m+HkZAlQF5rh/S+tHiLJENM30Q8yyNNw/ZcVF/AzR+a62izIjrARgqpuSIKdg9nFpTsId/Il//1q6J6oxrYg6cZGbskn9laT3TM7mYlrYQg55+iP/wyDAw9fbWcce34TCGE/glyFsFF29gWo2o7W1TecqPUg9L3wGIBgl3QcGnDdh2whnTaQ4ty/yiTWs67u/6+xIWONyYdHiPCndvF1T5mcTeuRuwLDr4Ol5MhdSsvr/P4VbX+RDKLY1C15zptyPNm0cIBqNtx/li/KZKUy71GlwWVvdMXIklfXVE7CWPWFj8XL8U+nvhY+6GuRVQH/mzKCXjvgFljcflQyVLNQD8lVH2xi2xpNd341b7woiGMUZYtgnaCRzYZZPMq6Ntv56vU2VywDwFPFnpwXieouo96MqMF8ev4zDv0a+Y+AcBiw5AVwqwUCJzTNJQEfYj8F5de/QpDWdXbeCFZQ0roi/2UCx4UNKiwkweXbcEWH0yUo2to4zThdUh/+2pf1qp4n2SjM5XcpE37cWovWs6mE9Hx2r1awxCMs3G3t4Xlkz7X3dOfc3USc3+V/q0HO0YrkIkfD6nAE9v0qcHadRtStQYvuaqt1nXvdPuNo0OxB2gryDjNpLVlUNQ+5Bh9ejDM4BLfIkFpfbsPRECSUS/6h5nvc06cGusYR6INDAWuILS2BA/DvF6HdGqn2PPJBLBLWJwRHM/OUcG+oKdqFkopc3q17/6G4cFkhDFV0LLlkI7sopE4484kuHAXu2FRM+xk5KziiKfAa8MGEVR3hvkJKcYPSUXm0Bc11+gQFdN6vjCXOk3kSxQyFhyqD1y1Vb9m3y9Qtuf2zJKAyVd7fMZwSlrpH3IqgHWb5Xv3N5hZRo m4OR2wJn dnEch8+z66zKvOuw4JztCd6wMdxWf884ACdPggA2F6zEOHhXiIcmg0ef80d/0JAA2xY5vX4YJbSAC09+fhJkGc9dexcj9fomjHzWtBA0RGtjYQyvtYHuiAYoOKP4nrzY8Fjzbsn3FtKRdw5xthbVEyeGwgQ== 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: Change hugetlb_cgroup_commit_charge{,_rsvd}(), dequeue_huge_page_vma() and alloc_buddy_huge_page_with_mpol() to use folios so alloc_huge_page() is cleaned by operating on folios until its return. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb_cgroup.h | 8 ++++---- mm/hugetlb.c | 33 ++++++++++++++++----------------- mm/hugetlb_cgroup.c | 8 ++------ 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index f706626a8063..3d82d91f49ac 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -141,10 +141,10 @@ extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup **ptr); extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page); + struct folio *folio); extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page); + struct folio *folio); extern void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages, struct folio *folio); extern void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages, @@ -230,14 +230,14 @@ static inline int hugetlb_cgroup_charge_cgroup_rsvd(int idx, static inline void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { } static inline void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 62552172683a..f3e1d052b40c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1206,7 +1206,7 @@ static unsigned long available_huge_pages(struct hstate *h) return h->free_huge_pages - h->resv_huge_pages; } -static struct page *dequeue_huge_page_vma(struct hstate *h, +static struct folio *dequeue_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address, int avoid_reserve, long chg) @@ -1250,7 +1250,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, } mpol_cond_put(mpol); - return &folio->page; + return folio; err: return NULL; @@ -2302,7 +2302,7 @@ static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, * Use the VMA's mpolicy to allocate a huge page from the buddy. */ static -struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, +struct folio *alloc_buddy_hugetlb_folio_with_mpol(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { struct folio *folio = NULL; @@ -2325,7 +2325,7 @@ struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, if (!folio) folio = alloc_surplus_hugetlb_folio(h, gfp_mask, nid, nodemask); mpol_cond_put(mpol); - return &folio->page; + return folio; } /* page migration callback function */ @@ -2874,7 +2874,6 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, { struct hugepage_subpool *spool = subpool_vma(vma); struct hstate *h = hstate_vma(vma); - struct page *page; struct folio *folio; long map_chg, map_commit; long gbl_chg; @@ -2938,34 +2937,34 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, * from the global free pool (global change). gbl_chg == 0 indicates * a reservation exists for the allocation. */ - page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg); - if (!page) { + folio = dequeue_hugetlb_folio_vma(h, vma, addr, avoid_reserve, gbl_chg); + if (!folio) { spin_unlock_irq(&hugetlb_lock); - page = alloc_buddy_huge_page_with_mpol(h, vma, addr); - if (!page) + folio = alloc_buddy_hugetlb_folio_with_mpol(h, vma, addr); + if (!folio) goto out_uncharge_cgroup; spin_lock_irq(&hugetlb_lock); if (!avoid_reserve && vma_has_reserves(vma, gbl_chg)) { - SetHPageRestoreReserve(page); + folio_set_hugetlb_restore_reserve(folio); h->resv_huge_pages--; } - list_add(&page->lru, &h->hugepage_activelist); - set_page_refcounted(page); + list_add(&folio->lru, &h->hugepage_activelist); + folio_ref_unfreeze(folio, 1); /* Fall through */ } - folio = page_folio(page); - hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page); + + hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, folio); /* If allocation is not consuming a reservation, also store the * hugetlb_cgroup pointer on the page. */ if (deferred_reserve) { hugetlb_cgroup_commit_charge_rsvd(idx, pages_per_huge_page(h), - h_cg, page); + h_cg, folio); } spin_unlock_irq(&hugetlb_lock); - hugetlb_set_page_subpool(page, spool); + hugetlb_set_folio_subpool(folio, spool); map_commit = vma_commit_reservation(h, vma, addr); if (unlikely(map_chg > map_commit)) { @@ -2986,7 +2985,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h), pages_per_huge_page(h), folio); } - return page; + return &folio->page; out_uncharge_cgroup: hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index d9e4425d81ac..dedd2edb076e 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -331,19 +331,15 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { - struct folio *folio = page_folio(page); - __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, folio, false); } void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { - struct folio *folio = page_folio(page); - __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, folio, true); }