From patchwork Tue Jan 3 19:13:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087919 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 BA288C3DA7D for ; Tue, 3 Jan 2023 19:14:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79BBA8E000B; Tue, 3 Jan 2023 14:14:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74CFD8E0009; Tue, 3 Jan 2023 14:14:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DAA08E000B; Tue, 3 Jan 2023 14:14:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3CC3A8E0009 for ; Tue, 3 Jan 2023 14:14:32 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0CC1540B9B for ; Tue, 3 Jan 2023 19:14:31 +0000 (UTC) X-FDA: 80314439184.02.1202E71 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf16.hostedemail.com (Postfix) with ESMTP id C692E180006 for ; Tue, 3 Jan 2023 19:14:28 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=U9eypNmh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="S+GJJ/VD"; spf=pass (imf16.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=1672773268; 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=W8Gt85xMEtaiuPPD2gNNoJcGHU+DxcUImoOJ0P8kcsk=; b=NnWpT8kmwfARVVZf4TL43Y/qjGugrGMH0SpspHUeBrsgqrrbj5lZr43LFFcKLmVejxCtar BXhNbAia6uHq+M7m44U1xIDlHqo4ZVKZeBmX7+hlUSQCrFNNiYYy9GxZu1B4zAnCwwaz+I ivthoCr5XJr/KNUwadFU/H//jkGgvLs= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=U9eypNmh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="S+GJJ/VD"; spf=pass (imf16.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=1672773268; a=rsa-sha256; cv=pass; b=4vyRoRsjNiXUM/YRMeT9RXqrq4Qxd9Bw4ox9zyI3kaEscEo1fCLTlnWRV7iAQ4KXDrEuft 02y5Zkv8p3EPZ3TtYMCOfFcWJE4r/yG1KWljqXRzRzfOjoc2xxdentKzVx7dWKhNs7G/1d dMUwmUSMMAP65I4Zy6Nxd7jBC88u+Mo= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303JDsAe000998; Tue, 3 Jan 2023 19:13:54 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=W8Gt85xMEtaiuPPD2gNNoJcGHU+DxcUImoOJ0P8kcsk=; b=U9eypNmhX/36UN8EFWlGEd3wYL4ifhhhflK0/hz44UB8X6QyTLoSl71sigkA/2lMbHzF +73QhtbztenBeK6tQWhBIvUmYjdqhB0Jlgz0vdamfDENihMmNnTAtyesnJg7sjqzin8z R6fdHtxYO4yn2lDfpEAUeU0LdRZUw+HytO5FH8zLNAalzMlLeYT5oA11wKPIzJvpHp/+ yneP3Qk44i5SVTmg/N63hOmiyFWBdMjbuaiuRaGkZrcpCA53+9n4dw8Dx/11V7JjtaJy LahHx/+y55qBqfyaBT8LWe3kXZ0pNE+PsAy0mSnYaCmfwdMu+lR69Ih4ucxs4dmvFD8w 2g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtbgqmxh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:53 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IOtmN012258; Tue, 3 Jan 2023 19:13:50 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2170.outbound.protection.outlook.com [104.47.73.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58pxg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kmjhcLiQ61hNFOThzYTUXM5be4VWcYoKuR2q6DWuYfRCNL1NnzJPx2rxOUOBhuqbWj2W0T2z763jVmjZR1RJPdBaz7fA3m49veQ7rSxXoHAzFf+VuUu9lVd6Q3zIJSJaQmtJlboqnWwmhidZVtaG1/m5FG8rG3S5y1z0lS2a1RmQSMsrZcEPlGOptqjzUNmzIxMnktqZczTEft35YLgxTlfs6HIrXbHmYXwe+JAxbH+3s1F+EpyxvNXsSgRz33/cwbRTW+38G+GcvyZUv3mXr6+v1FZXXEHRWujeVUUEE6wm0FeYHwT9vz2ennySbadi7cam5PIbwKgQ98V2JMFNxg== 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=W8Gt85xMEtaiuPPD2gNNoJcGHU+DxcUImoOJ0P8kcsk=; b=Chjo87XQUWO5pTg2he5Z4cGzsEDWbQumAlSXTSBH99kuiUDbSxgSsvOlhO+Hr0fozhVsDwwL8kW9MYlhtBjxUqU5kh2aL3bQhMVAUletZQNSOL1SMJtnAYcyOlsE14qCkp57fMo4UOIHzFJcaGOTO8ioBtqBis0QADkDwnH9n76UTbBRLQ52iZaDSCtDixkou66VvqFOypS3cCpQUwaFRx5JCaJu4kbY/Cy+P+2m3/JsoFN6GCQRdMeQKKCvBnoWHXJ+rT+Tlt8ZD+EB/G70Ef5uyOP5uyiuOPT3SRgm2fKaNnxQrNbnCrSzqZJZT6HnTGSzVSl4odCzNhehs9t/oA== 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=W8Gt85xMEtaiuPPD2gNNoJcGHU+DxcUImoOJ0P8kcsk=; b=S+GJJ/VDhieBWpd6d3d/KQlK0bF4bK92GIa0nBJ4k80lU0saQmqYi1xD5JsTzbNNc6LSpnbOPIa/nCHduDQjNbp8V+LPnvGg1YHJuRw65FYMDjUeAnVTzvoAWgWNpFaVR4S+JSCeHUx0grlHTc600VyDP3chdZ3AjVw9v30Dz6c= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:47 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:47 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 1/8] mm/hugetlb: convert isolate_hugetlb to folios Date: Tue, 3 Jan 2023 13:13:33 -0600 Message-Id: <20230103191340.116536-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR13CA0034.namprd13.prod.outlook.com (2603:10b6:610:b2::9) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: ebc1d1be-4dd7-43f6-6a23-08daedbea345 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hbYCFoT7MLvZWVR+shvq9XxVImVDcdgfMV9gfxNY0KGC3/MVZZa+SXrLsdzjZOPBIRGr9yat1PPohdrWwxjD1L8p5NulcpYc1VRPFYaL4LS7/+DS2WRgfq2KVgYRSiy5mdl7dYHTrvz71b0bgWRsBU/rduvK1ubdKInO/5WIOBqrRq15UXXi6vN+3bdPCm4PIKj2gHdRr6Okqpq+zpHfdSShbK3SEd8RXHF8EEiiy9PiNYf3Wqw6ZP6iC6Mm15hn1nMhp6Fbzn1CXalTGzYNP7jjk4lNHXnEPDpfzt1BU7+c1wz6ttWVvxptkD1JsiIfZhy21g4bUdWivI1CyWSHE5DY0M5HuFrO+5uvVFXKyy62wdrWXhq+AS8eZA9z83xDESF4l77KX09LRP+jZ9FwEdiW7iQ5v9SDeTuWNDGB6b5pcjRGKI2RDS75t1q/XhQVJg9Qp4+98YjNtJOK7ebNAURzl101HpWd9+djvDlOyAoAKWh4/7haR4FXortbOC1qEjpZk2v/6c0eCD+dyzC9gLSA1xRglSe0uBfDvojTBU80rWjvAF1CClnZfcKtx8VoCGYsJT7bcuFzb57u5zYLrrerYYJud3q9EHCZYiV20LxiRv/XdUnbgYB5xI/aPNj8mT2iZYcrnwsulZOjwSIAeZevHFdeB+WiA+r515auGQFRgUTWAf6PZKdOuC7sgZlO 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lqCyXaJoxfj9v9OyNUfYRZ5Mvu3q4AntYWXMOXqZWAv4RT8nZTGfrqz+KGV9tUPQSeta8K6bozmB+fE6dXCncoxAYEOBcEuUAKm6Ao4DVlcy5lg1eIu77eI6lcyqFxrooKYbwgkwDIk6hE6UzpAuC11CO3QyBkxhH/AsTNTopIyz+7A3iyEFG4QDD8cQ2wVN83OdyBLnduCJF/Hfku/xpPd4U3gute/+A/CMCc0Q3AkMTOHCJiA2cY66gVJrcEfNDKQXVAcOossMq7ZB1oi3Oy07IfKWlJRHflZtPcxnMDjq/pit74t/k2WdqiqFKHiLgSXMFRhpnKbyYJ+HbEk6ztLCeWcNGNNZf1u/5d3a5oIS65U8d3ngyYHvigPuljdQL9xT+TvDg7R19YE9U5p6mXVWZA5lUkBmZmd24dDpI6VkLNPNJTTZjedI49fDyDWBPHT951VomokUSpz1SI2hxz9YuroNKN0wPAWCUnHXrz205cPUui2SP4Bx9vLY0Zqb97vkd7iD/f3nDWoo9a9KyzVciyUFBLVt34cH9fKK2iWCV3oa+RlmUl/72YELHRbxwhlz8IKlezF07uXqpFFbWoWxDLCRMqhFY+LDJ+v9e6oz9UML0qJwaybEEI78sT65pi6oLey3y9O+uVzuBGd/6JVkIDx2UIoGSJVcyZ+rPcQkbLyneKLy6PmrV8KUs5Q2v7SqvERl+g16/e78AEkGuggSD2qBKm/QHqNWJ2b1ljeK4xgKxZ3tNEWDbiqR4aIuuY37S/7RwluC73KWSVKKS9C9cTMIBTSHQOq2jscS6pKNsaAAvCYHuiN6eNHTdGD8qtDIg208CIXNcITMjgqcvB4hdvA0BEFdmTniTJ9ot5wrV/uwsHjHwwm11tVFnrD2Uc1UdzM6beJPNlMmmVESw6/hY/jSRtcXpUotsmmE7rlZcBa7cAH08qPs+7sbCVmP5c5MfefrdS5edytr3zP479jh+lF5MLcX2mm/6YO8RMUqkzqfJKE9UVjkP20cNlXtWMmBoKv3MCPbRZs1z+RiyrIvPY7TUGduYM/CyYrHDkLl+GBIwTHPHu/UAIjLUUX6SkYdsw8JZcHjoQw+8QZDnvcSI/kugrSRPs3yjWRdD/fmKIa/TAMUq6/iO7i2GC/+RlmIAFv8NPRyrUom68HsgHimEGAt8U4xW1YxFUfErPhK+vQwyn03mjrArbTtdAyw8CZn1WaM0+3sp1xmiymi+3YdsHPiPEvvPzqc3rg8cWz5S1hgpUTeR8h1nZfOXRAyJzo+3QmHr+RMbexJ4PXVlyYiGTWabYiz1LnL7b1VGbvSKIUjhrARZUiW/eYjq4Z8sHqA8emu9nLOYGXr1aZV24IcvHNiPol/+GadYFKlEu2K3a9lbq/B6Q7ySl4NwOPnoOtsAKwza06B883EiBhYqcEXq8boXbpCukFGyLoyBOK7bGyQa3+vK87ZuPxplwh3men0DhqaiXdE9g8kULI/J6wQQE+h1/IwdZ+hoOtDn9SX496x5doUN6tRR5qu1rCrO71mN0MWxPYAviNmKp1Hyw1MNp+B1Ngrg/Fo6U6Xeq1UX2gKwC8h5eV/A/mwyY9MzQHw5QOhUXmpKd4pge2yAw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Z9fb13iXKKmY+y7y6ZHev/RI3RszxFORlmOASuYr2n0IsMTVQNzkIxqSjsu+HLXJ4cbuWXRciSKXegTm9SKmY81Plco+NDtJbryBoc+ctweeyjM+Z9QGYYDaXkXaA9yuWFMFzt4CbEOe2YH7gF6Kc4GjBwHYU+uLMo1gVwbPXdax2JSEozw4Uk6TbqIgNbwU+dZfwyqrJTpBvRXFq21+HV48Cq5vRO0av8Z3SXGf9zHo9rsLlzByFX6Khn/XzLKa9+6xTyUcW2+liy6lrtBlycE33iE6PSPwvBK93IDvj774rAGXVrUcA7fV3hy3b4SLo8Zc0QZuPbvNMQshOVYNjFgZEgav+f6SLuDZvGV54aEgCVQ3fuKCx4PNpJAnY88E86vrxBI/YOuTJyzTWwQwUDrwKmx2Ps+7SyvqX6r5T/ind5lhFLC4qxLA5b5gaadQJrXZdPy0iNR7U3EfiDNZRYj4WeqKJ0x9pq9L0fI/JlATgro34hE0P3Z/xHf/YoRczbKSt/5xvSrfaqdgTUbbZzmvXL2UkbND/qb1F77FXy04xKsxAhgBiDu0ghKY/XkNI22lJ7/Kkq32FQx77nbAnMJ04Mq47LftPE5DxpuDNymfFyXH6lFjWEqp1lE7g+gZTQJuSKKXCqdJ93gZgInUlNXB3+8rnA/qkabCwkeCVJIcX1AVSgWUiolAMlHud9uzygXyO2Nxx4pAxf0N+t9CNLl0/KgWVjDORF08+vxx0/niOYc6hfpNHozRw6g6GsgdgT3cLhGt9KL9zBzLAuRMZ0PF/hEPQjTE3WZDqKg/2L4u7NI4FuCr0j0hpKhkPqEyL/euNVHbqbWs3MZUlNQo8dHznai5ZSJAEPUVv05fkMgpGzy3WslHKN0d7gNWGg4iSRpCFM9zzjOYdvXRZ/1KTMQ6ZVee/DX1V4NqFUZDrauJjcQBLamjJfAPPuOU+L1TJc/VIKmpFB0nNaiuIT1UyrmgFfdacwrY0LSaE6Jz0Ts= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebc1d1be-4dd7-43f6-6a23-08daedbea345 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:46.6556 (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: v+TZK73zCspayRfUjchOIS5VHCQHlnLXqzOZ9i9p8819YyZeKlmQxZPMklO2fo5e5gzspSd49dR8Aj2dZ4jiaFhkQvu6pE9Bkx09Oa60sjw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=926 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: 1eLh2ZmeRyzhNUdijLwG2NABm9zz9l7L X-Proofpoint-ORIG-GUID: 1eLh2ZmeRyzhNUdijLwG2NABm9zz9l7L X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C692E180006 X-Stat-Signature: 3attduqsmi7k1nokz55xgodbihu8jnuw X-HE-Tag: 1672773268-488211 X-HE-Meta: U2FsdGVkX1/xjwBnJsvdpunLumfYB8jIXcuHFMpV7DKqCEQKANrYEn2lplKXR16YnAcU1VRryV6RkrzNT/fqBpNDi7ee+ftjsHRJsbxPR0gX38/T8s7yIrJL9c9oUEz+fehYpRgcnZjggSkgGH5sWBHSijPXQQrSkmYfLxTCzzNdzuVMKHyUrimrcwKcbMX9kPlws4vHmT8af+C3WriRdwQT4rKSwQ9fEkzXpN9n7PXxoYGrY6N5qpgxKamMTGpZH3+sigFrMoW4t39GxlAWrrYeM5PrzLrueIIiNNCncdHTw/+O3VTbYNMETeAiCyQNIn7OCoxcBw/Da5ExFPdAR/VuHzFE8va242R/Uqp6pZMgu2zKN2539Ht1hvPrkxBCQw8HfQeCNE0I0Wbbh/1KGA8CNnaiC8w0O7oxQhluOUDWk3/0M3HQhAQmz65r6ZBx65AHaHdBM7HcBFFfhNyzFfHBfCljEdir6Jakj2eUr7BysHywlPOm6b/MTEYZdt7BDfJMI7oKNohQdD5cu2p0en52pe20N9AK4GWwOLeDyfdzuBvENMJLp7NAaBWTSgf0+hlDbuHlB/1PE/70wIcYALc2TT7HJafT3ZDLzmVCXrV8BThHV94zq57hrIcPaYzlwgZAIZtBfOh7NQsPw3oHwrOqN1WXQ7ngDPEA+mKT2LWnRYtSK2KiZ8r/lq0vgRLu9JcmUOt3vRSSDU74S1LBbGclFJOZo4EnW03PYmA+z3hk+ZII4jl8oe97IrQ13INFLx+iDjMwbwa6l5VPZaIzGtq0MsV33Dsnst6m08rs7AIi17Vac7/3SUV/TcSFyqP8wzSgP4eclP9ZK5yX4HptvHLcSeGYb3TEse2+c86UXrcGhK/V+/rEYVlDZry6Ad8xd4okP4+3BGQjvWrPVhuoc6b7uJ9OUXCCeU4W1Fz9wVSlhSe2Vcv/F1zXY69ZSrGJkUosRwfrwBh8U7LnuFB 7jvlv+FR wl/MMUAuI4YFdV9fMUOIYUgQfpkeB1ZelhTA1eHba7wggEaUhsu2bTcY8kmfsjmn/GW7TqmhbYjIbMnT8RS72NMmyXHb7K4DaauDUmfcBHFgZoUK5THfotZR8ZZ1XXGlHNpR3vd2XMPHskAEwI2BlTLwhSw== 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 isolate_hugetlb() to take in a folio and convert its callers to pass a folio. Using page_folio() to convert the callers to use a folio is safe as isolate_hugetlb() operates on a head page. Also add a folio equivalent of get_page_unless_zero(). Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 4 ++-- include/linux/mm.h | 5 +++++ mm/gup.c | 2 +- mm/hugetlb.c | 16 ++++++++-------- mm/memory-failure.c | 2 +- mm/memory_hotplug.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 2 +- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 551834cd5299..482929b2d044 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -169,7 +169,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long from, long to, vm_flags_t vm_flags); long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long freed); -int isolate_hugetlb(struct page *page, struct list_head *list); +int isolate_hugetlb(struct folio *folio, struct list_head *list); int get_hwpoison_huge_page(struct page *page, bool *hugetlb, bool unpoison); int get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); @@ -374,7 +374,7 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, return NULL; } -static inline int isolate_hugetlb(struct page *page, struct list_head *list) +static inline int isolate_hugetlb(struct folio *folio, struct list_head *list) { return -EBUSY; } diff --git a/include/linux/mm.h b/include/linux/mm.h index e2dd5a37d078..cd8508d728f1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -775,6 +775,11 @@ static inline bool get_page_unless_zero(struct page *page) return page_ref_add_unless(page, 1, 0); } +static inline bool get_folio_unless_zero(struct folio *folio) +{ + return folio_ref_add_unless(folio, 1, 0); +} + extern int page_is_ram(unsigned long pfn); enum { diff --git a/mm/gup.c b/mm/gup.c index 5182abaaecde..bdb00b9df89e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1843,7 +1843,7 @@ static unsigned long collect_longterm_unpinnable_pages( continue; if (folio_test_hugetlb(folio)) { - isolate_hugetlb(&folio->page, movable_page_list); + isolate_hugetlb(folio, movable_page_list); continue; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0c58f6519b9a..90c6f0402c7b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2781,7 +2781,7 @@ static int alloc_and_dissolve_hugetlb_folio(struct hstate *h, * Fail with -EBUSY if not possible. */ spin_unlock_irq(&hugetlb_lock); - ret = isolate_hugetlb(&old_folio->page, list); + ret = isolate_hugetlb(old_folio, list); spin_lock_irq(&hugetlb_lock); goto free_new; } else if (!folio_test_hugetlb_freed(old_folio)) { @@ -2856,7 +2856,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) if (hstate_is_gigantic(h)) return -ENOMEM; - if (folio_ref_count(folio) && !isolate_hugetlb(&folio->page, list)) + if (folio_ref_count(folio) && !isolate_hugetlb(folio, list)) ret = 0; else if (!folio_ref_count(folio)) ret = alloc_and_dissolve_hugetlb_folio(h, folio, list); @@ -7271,19 +7271,19 @@ __weak unsigned long hugetlb_mask_last_page(struct hstate *h) * These functions are overwritable if your architecture needs its own * behavior. */ -int isolate_hugetlb(struct page *page, struct list_head *list) +int isolate_hugetlb(struct folio *folio, struct list_head *list) { int ret = 0; spin_lock_irq(&hugetlb_lock); - if (!PageHeadHuge(page) || - !HPageMigratable(page) || - !get_page_unless_zero(page)) { + if (!folio_test_hugetlb(folio) || + !folio_test_hugetlb_migratable(folio) || + !get_folio_unless_zero(folio)) { ret = -EBUSY; goto unlock; } - ClearHPageMigratable(page); - list_move_tail(&page->lru, list); + folio_clear_hugetlb_migratable(folio); + list_move_tail(&folio->lru, list); unlock: spin_unlock_irq(&hugetlb_lock); return ret; diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 63d8501001c6..cf60c0fa795c 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2438,7 +2438,7 @@ static bool isolate_page(struct page *page, struct list_head *pagelist) bool isolated = false; if (PageHuge(page)) { - isolated = !isolate_hugetlb(page, pagelist); + isolated = !isolate_hugetlb(page_folio(page), pagelist); } else { bool lru = !__PageMovable(page); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index fd40f7e9f176..a1e8c3e9ab08 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1641,7 +1641,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) if (PageHuge(page)) { pfn = page_to_pfn(head) + compound_nr(head) - 1; - isolate_hugetlb(head, &source); + isolate_hugetlb(folio, &source); continue; } else if (PageTransHuge(page)) pfn = page_to_pfn(head) + thp_nr_pages(page) - 1; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 61aa9aedb728..4e62b26539c9 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -601,7 +601,7 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ if (flags & (MPOL_MF_MOVE_ALL) || (flags & MPOL_MF_MOVE && page_mapcount(page) == 1)) { - if (isolate_hugetlb(page, qp->pagelist) && + if (isolate_hugetlb(page_folio(page), qp->pagelist) && (flags & MPOL_MF_STRICT)) /* * Failed to isolate page but allow migrating pages diff --git a/mm/migrate.c b/mm/migrate.c index 4aea647a0180..6932b3d5a9dd 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1732,7 +1732,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, if (PageHuge(page)) { if (PageHead(page)) { - err = isolate_hugetlb(page, pagelist); + err = isolate_hugetlb(page_folio(page), pagelist); if (!err) err = 1; } From patchwork Tue Jan 3 19:13:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087916 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 9AF6BC53210 for ; Tue, 3 Jan 2023 19:14:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCDF98E0008; Tue, 3 Jan 2023 14:14:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7AF28E0009; Tue, 3 Jan 2023 14:14:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7F788E0008; Tue, 3 Jan 2023 14:14:29 -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 98C2E8E0005 for ; Tue, 3 Jan 2023 14:14:29 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6DD908027A for ; Tue, 3 Jan 2023 19:14:29 +0000 (UTC) X-FDA: 80314439058.17.63ADF9B Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf07.hostedemail.com (Postfix) with ESMTP id 4CB614000A for ; Tue, 3 Jan 2023 19:14:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=PQHTlecY; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cwzq+vAj; spf=pass (imf07.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=1672773266; 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=nmxhlfpLfRSO3dUF47ZIWemR1CIptCOWAJSWro+sA0A=; b=cJUTDDLr1dfmwI+lh3eYY/KZ1kEQKxkpe51KYZl9oz0yidcpv/aAV5OlWKZU4EIRbfVQb4 qxk4UZfLN+E8N6D4OKzYyZBVAUbiacgB6SplIPvLu6YGnsjmUaCnIJhY0JvYz/OqICn2g6 HjZadr08av2+4S1n7VUFu9lzP5tWHjA= ARC-Authentication-Results: i=2; imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=PQHTlecY; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cwzq+vAj; spf=pass (imf07.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=1672773266; a=rsa-sha256; cv=pass; b=0EuEpLX3TWL+Gt2twHc+R52bzWsBBrg8VUSE9I+GWHs13aIIXiAQIxF7kvQuun2rWSl5Ig 5hg/KRA5nbmdCTv0EHZchNjq4lcTIerRkFdbi3jXkY/uAEkAHc6ro3FKqdGmnvVQK+OCqY Ve3ZdZJhjkG+cfwXzwJyW/gU+WCMy1M= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303JDs4u001004; Tue, 3 Jan 2023 19:13:54 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=nmxhlfpLfRSO3dUF47ZIWemR1CIptCOWAJSWro+sA0A=; b=PQHTlecYd0kLfXFq7fiD4ej3/8kSbxPE30/yfTL3Js/O4MAClv8CeHsSNaJKCWrTTRWe z4jUfTWgJDTF6P94+PCyiQy4Q7OQuNUehGR/chzVXDGHHuupqEbtHyLS31YsuaydfjFV Uk/tgY0gdqkz0nPY6ZbaOCXkYGxd0Bw1NpqED3vWquCwBbA+xmrfrl8Q4qQqUrxV/pT6 VLPoz8/KNuQmM5TXn865CdvdvsF1OXuaFddOnOtklqjeE4ngUl9iV18i735QXkJh3nTK JDsLEVWF3GtU87WUSML+5i2iQuXe9Be7xfB4TXzKWqb7Voez8L7WKGAKpFtRB3zM4OK9 nQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtbgqmxha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:53 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IOtmP012258; Tue, 3 Jan 2023 19:13:50 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2170.outbound.protection.outlook.com [104.47.73.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58pxg-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YxqT1lKBT22Q72IWVKokcpCL3f+vuZhzcHzLekcOfaGZX3vv2J1xw0ddFrkcrsjpe9x7jMuegVBVpzaXLbGBTvqI/mm4cz/XnHhTx8MHIzQAWftFgleoYfdkQazWdrnXBvsnAsDVzEuF8G/h78mqKS+gog5dEZbAc5BONEchOCEGd7IMDE3cR1A4/g6Gg7rO9G3ScszzF9cS3EbRBgTNemr2r0m8l2KlXjYYkW3bPJDl3NWdPjF9eRZHN4kRqy37bhH6NBmcIOs1kWJAwzEqK930chQvuk1cERfmrCRO4lgWhv4yZo6f8P/IDZ8mXU3R1zXcVFihdauKTihoCeSJbg== 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=nmxhlfpLfRSO3dUF47ZIWemR1CIptCOWAJSWro+sA0A=; b=RbX2LNkW9InXmoa2GzZNLKBRvUl0Zp569+gj/xFK2dRbqay7lMfccaYN0j8sgzwImxVFvm4S7frpa+t2foNSKPZGirbtJkR+oy4NoCUXHT1SQ5GWAp9ofl8yBv6lW4YPVmo1IXfyPCo9th9vLmOJhqjAfsl6Ry8HKj/mQYo/7o3uKtjePZU07i6lQiJY0PXqzokK9CMhOfGarY6d8tzpeUgqfzQeo8eup9l85YuDYlCcuB9D1Xahe2Mc/4Tkd9kl03OykM6mFg8ZKv55vGqFRySRPImDR66QlyO2To4dS069/s65pYTGYTcWDxsT/F97FnwSgJCPDOitV+X4kCJd2g== 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=nmxhlfpLfRSO3dUF47ZIWemR1CIptCOWAJSWro+sA0A=; b=Cwzq+vAj2/HYqXlobLJFTlshulpIHtX03OCxB4VRUOdX1FaM0yH5WYcuVhmVcshhe3H7dJ3oe/gZoycibxgrpRV7E/5QaEKhdy7UHYlLse9kO5Pz66y/xWtHaB79AB6MwOCLpczs7tWmRp9Vrd5gAliU13Nr2dBE5YTrwf5rESw= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:48 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:48 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 2/8] mm/hugetlb: convert __update_and_free_page() to folios Date: Tue, 3 Jan 2023 13:13:34 -0600 Message-Id: <20230103191340.116536-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0438.namprd03.prod.outlook.com (2603:10b6:610:10e::14) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a1f64b9-a329-469d-6617-08daedbea417 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DVDBZ0anCoB+65Yo0lIELu9eMwV5Om3ZQrImRGYsJ13kCktSz6zpOSICGrSTgVx/Rt8rPP3/0Jma4Kq2t+8r5diugxdmS/eXdN72s6F3W7NXGueTdrrUJshuCZUKV31GzC6n1h2/7sqtNSQIXRqyQjW5kyIDKcd0pjmREFvJXcOwQz52+jl42B8jzSTsxgeC9Pvnq23FX6y7+7sVaCzZv0zFVaynbyF+PQ4r+PY244VlWRiJq4t+MdrTDQGZq6SF4ZCNBuFopLwNRwwy36C2z/Zw8yGDKai2DJdeigQ2N6R4A0Vbzx8YRDOrdhIT/bQ8HFr4Wc+E6BjT9uSaeTxqK9s4MDoCQHJMJOjNNic4e/RNEkJYIyUq4OQukVML/lLORbYiJrdS8UwNKHsZ8fMQfypl7NSD8lZ4jZl+BGA0JsistiGhrP7PworNnUOamU5XTO0xgkvaPp6ZBwWe9DVunddkDtrkYIi+psVxRVQporWCgXiBZuOtzDx+6UQwCum/Zj4nc6XEi2p073d3SGzFFFQBv6DS3DgTyqNG1fbwfEgY+Gx2akAyQnEbLM+6yn1J5pLSVgGWjJN/b8Ass9OdLp/WwIkU1PC6KtKrQ1yFEp9B6umpMHvb/41LCM0HAELTDhLscgyvwurgJmgqMTUp7zmf6cKGdWA/tyvvoJsiaFL0wPXkHDcsdd8RrHHS1ybF 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BelMtur2pDte7RjtycTYDuzsupD5vblRv/fBfszIDXPHGyokYWTXZUNmIf8PUnysZlR8OISR79qJnRbYt5ZvQpNwtXCYUlfc/kD4bLIhjoGZIM0GzQUIrZ7f5D5G3IuuFEmGXPZEoHjwEQRnLXlN4+2Mb5U757DNQ+j6qSBo1N4/maM5h8lnFrhbAbIo62GbfcFuSTOshnSRfUOu2JR5UAzGMG9qFvtqpUrg6oubUIVQBDtSeHAAogXlFn1asPnhphG36TJYN+cstGFwYHh9mdYO350mNvxzY3NZW3xM26cmr2ac8c/XqmO99Ek+owNLMjZDYCIC6ubmwjL1c9zaL07RdNGnUwjHRGd55dsOGJ3JoGrDpd8iRO7DnSikgWvgUX0zXtMMfPXk+AXx5rA9/0hXoN/Q2jB6JsEoyNaF4viWI4yXbSvC+txaxJeikGi/+0jX6e+wbJ4jDoq2nP+rEhT/Iadc61qh+WniGlWYRXXXU0/p61y8OtfaXWift+n/Nsjtu6jWEzLUVHXDuJ3IMJvNXAZuqpMY8aOw3YJfW3IRJygmNWPeMRBC35lt8UsR/nNHkf8CL9xeUcNxtNRA5fy1vPu+3jdcVsx5bWDa8DxAebmrrRVHycvdp10/gObsp6OkUKutZ/4geg6eWaNwZnRmUBW5R1pBa1nc5oW6pugt6JW4oRnrjYoLTfkhIAnFHpVecHtIPnQhjJVixuq+Gx1c7PLunB36Dnsp94iPB5cnwpjfFfhNEuf90xJTB06vXB6fwifPxlS6461a+oydAXMm1yx9ZdNrh2jPvoYMiC4R3W3yYGKtf59DgqVMFbgB+N3/LaFuZq0UolD1b1iO5O2wYMtLNzlRuMWH+1OQiDGRo1nlE6wryt1D7gpUIC+XujFV4WEZ/OWhygkxqz5xe/yIcWcx63KydeDkI2ISslxZjvcH2kJt+bAG8My8364rqP4/3OtFrGJ50Knpzu1WvqgLsBHjviriorWIp3yLeDIpMpnQzCsLVrDNX+7ykqAE2uFAZns+Gmcmd28C8YsJIByY4VMM0ZXZaNekGwqEd/euRUBGahIGD7ZPJzPzhyLNal+tcCp5wl12QEeVabvYaxvJ8bYxqQMekTXnrsAI8RosBSzOjcxd263gaOqvJLG69PeGs6LF5zckClTBNf8F8MRhLMV8kzSJO+tbONx3dcYrN9I1QxVTh9jZOJkm80p/J4XZA5GHifTJ8Z4eY92by3EXPbPoWlBJQAF4UX03m7BecXxSbwvjUyRkAE20y1BeS0PNV9dpl7lP3+piESYcZ96wku79iJiRj9lC4v7oeE0p2ANZCIUx5yK/s6nnEAHt5EBYFHIPOrmZBOKS/C0k+DhpOL9xxtT5jPr2ED1ME25FhbOUAycebiGFdOqNw57A26FratW3rGOJ8uVa0o9gHmnCEWJ7RRxzQ1xlo/oq1OWlKGqsceYNzV00JG06OE8FpteoOJfiT3Bh4iYJIj19fkxgcw5Ta2unjsGVHE0wG8M9Ep4vLr5CNOCVSMUXBjGOMEcwW9LaPzfPlxu0yKioVBu7W4N/iHxoVnUdnWTDj1pYIuTF+8ZLIX55WoCuRSrd60T0CrXQxKdAJN9WUExSIQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RZIv6I6CKCq1IF6kMtQmklXOPAkcHhLwDR8wFtnz8PJZPaXUDtMrhQbqcuw4Rf2kjiPmDg0pf3JbSl0QaiGdCNaefMM0W+xmHUJWDxNMF2QeOHn83kvICvQg2VN1FiS4pb/TFnzGqbNg8KvHmeFP0p/zVxujNC8gINUFz4+uiiPpT7DNkH31SdlPa1QAnG088/EU7aLBkI2/KK2GeIfOmgaWOzc4q1U9xneZrri1moQZsQbOmErb7su0NQsFVRT6xuXaAWOzrhwVN79QtOc0JPjztRgQtfPt6XeK4L0cgIduOuNQsLrrbQh3LLuvGljIR9/pGtZoP/Dhn0UiqDsnfZmZeWRtNYDB6m3n1lBO4iZ65zF2bTqXDUtLlndVpmMVvm0SLl3W9EeGhrmyD+TV7V0fO4fyoOktax7+M+dSD2ur8FANImUyP7ol+npl4oIOdQtPQ3qlBcr4yPagSUkMGVBlhKVMyOBOhlmq3HK459ux0jKr/WWbPTs+njLg+MtKXp9YqAxrC1SgVoHFwTys4kBWMWxq9DnKndKXyJUrScVR8UrbsNAec6xc2cbqf+/AM7cLjTtL8Fu8aZjfdIFm0cUN/JwKll+0ATtNAJKHGzFsbHYLloCRWTdAK7WuoMvaUnxsDk8uGZ2g4b3yr5RvbKzx437OFKtSi7i+K1hTpib55ol9Jwbrab2W7bQpgt5XTyJsD5hfFoGpt+E/S+Z+/ianrCzy6KgSo3JV3wobmzXi+iqY1/5J3e54aKbwqOeUwTF5uxH9IN5Wt8lABnfoli3lOY4Zb3TcCgsHP2ZXHBkWYBzasyf8YhZOeTgfgR58NToJqhrykZ8yB81rKM4q76IZDVZIE98I6TwyBZECg3TLSh7U02hvZJqTQe5SWp/XYlztM/Xe+AOIj1h0+MeUitA501UCibuM/Cd8sobOkZ0H6vf3cELlK1P3OHGPz/LZ0r8Gt2x2/A/5yTZe95y/YSlRfDACfOLi1bkWVA4ywHo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a1f64b9-a329-469d-6617-08daedbea417 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:48.0943 (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: 4wjLtPCbodH2K9Gp6/SUBdGMoaZ+xbVhI+CnxIXRE4c/tsr0k3Wej3d4gnGpznGHZEPoavkzg6wxZ8ABb8dV6LW3beJy1k9I2RzN4nTB+5s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: yxgObO0oQ9E6IEi_IE11GawBj19kW2Cu X-Proofpoint-ORIG-GUID: yxgObO0oQ9E6IEi_IE11GawBj19kW2Cu X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4CB614000A X-Stat-Signature: 8n1nbxojtfyhz6un5yzmc4oj3rxrrsky X-HE-Tag: 1672773266-646422 X-HE-Meta: U2FsdGVkX1/iQpzm7fSrQFZLYf0AcLO+9DVZ5TYo4Wm6hB4cvDd4ip7gvyAHz6ZQ+/ugcKId6QWL+QU5/JPWqF8zz+5F6eaTkD49GQc3h1RTfkip9bcYl6vZCyT4axyyk6rN0lCIMnut8KKG8FRsKcHqy2RzN7KKRuAFCuhm2O0H6nOrqSoj3VuaEOXYtMVSP8RBTNzMRpQ1Y8h3DMqZXPCIrtmGCb/qKe8RaHcTZkEzkkjuJa0uKuiDbZdbwu9JivTA0Wqq08toOFCeqRgyYKF35kxL8F/ZbOqWzLBSsh/gA6cwo4wZfSnqdk1FYiDHsYokY8M3JHcOLYpkIlgH0wqDyrtZ/7Xiim99B9h583zs6Gx/egKcfA77I5Kjofr63fiwuOaE5leIF+8VC5QPPI9VEC+ZAaqK4QVs43HN7lnJy5m1c99Sfd8tWKRAs/AYzzp89rGjZrZRmar7zM+7+YQsfOqo3QHyTnoNKDoD9kzisHxXXU1ZZdCR47zSPlclr4bdJYUhCjR6oLkAWVisMQyCBD9SsU8VSyf4m/05V/y+ZNQRHSRQX3npbGJUWogAALty00nK9Bq/gTY6hCS1oQebl3GHpSU1uJ/cOXCtFKH6bK2ffbg7+Xmmui1RcwvJJhJpjJdAR21/0gi5UCGBuhQGJ3lOx8/5diRMghG1P9P+BZVC4tUtWP5YtbIEKeEK/VKBdXi2bdwYHqeWlGpQtNmLqsil+0AtzNFWLK7pQ2oT3oG0gUNfi6OOCdnHbgGJVd60igR27GISVKsB1Lm78sDpqh2QOKQ4jIYRxlbFQveQEG+jY4soAnTKTiAjWDU4xNdjhDpLQsSM7M0OGYtyQp53MEvDra6qPahUt1xkAsbngsvxTKF6ey5oWx5RpKJzl5y3Ykpx30I1bYVjDayammV2n23HDm9/Lhs+LAOul9g4RDHscjONAlj5f3228lcLZTejfktjmgGB/f2OR3v v8DoujxY dKK9kmwkdEKkTBgzuhHsICPzLDqwat44td/3x9amZPe/dVaSynNvXWjq4GqMX9UlxNDqA8Z1/Na6VriHAWoROiS3MqXv/PdLeszaYhtwys6qO2+F5d+yStybv/6u6BHpSdxA753wsAN1Ckshg3Eo4pXIu/w== 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 __update_and_free_page() to __update_and_free_hugetlb_folio() by changing its callers to pass in a folio. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 90c6f0402c7b..b06ec8d60794 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1556,10 +1556,10 @@ static void add_hugetlb_folio(struct hstate *h, struct folio *folio, enqueue_hugetlb_folio(h, folio); } -static void __update_and_free_page(struct hstate *h, struct page *page) +static void __update_and_free_hugetlb_folio(struct hstate *h, + struct folio *folio) { int i; - struct folio *folio = page_folio(page); struct page *subpage; if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) @@ -1572,7 +1572,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) if (folio_test_hugetlb_raw_hwp_unreliable(folio)) return; - if (hugetlb_vmemmap_restore(h, page)) { + if (hugetlb_vmemmap_restore(h, &folio->page)) { spin_lock_irq(&hugetlb_lock); /* * If we cannot allocate vmemmap pages, just refuse to free the @@ -1608,7 +1608,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) destroy_compound_gigantic_folio(folio, huge_page_order(h)); free_gigantic_folio(folio, huge_page_order(h)); } else { - __free_pages(page, huge_page_order(h)); + __free_pages(&folio->page, huge_page_order(h)); } } @@ -1648,7 +1648,7 @@ static void free_hpage_workfn(struct work_struct *work) */ h = size_to_hstate(page_size(page)); - __update_and_free_page(h, page); + __update_and_free_hugetlb_folio(h, page_folio(page)); cond_resched(); } @@ -1665,7 +1665,7 @@ static void update_and_free_hugetlb_folio(struct hstate *h, struct folio *folio, bool atomic) { if (!folio_test_hugetlb_vmemmap_optimized(folio) || !atomic) { - __update_and_free_page(h, &folio->page); + __update_and_free_hugetlb_folio(h, folio); return; } From patchwork Tue Jan 3 19:13:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087914 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 DCD12C54EBD for ; Tue, 3 Jan 2023 19:14:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7A448E0001; Tue, 3 Jan 2023 14:14:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E030E8E0005; Tue, 3 Jan 2023 14:14:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A586A8E0001; Tue, 3 Jan 2023 14:14:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8F8368E0005 for ; Tue, 3 Jan 2023 14:14:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 63CAAA0AD4 for ; Tue, 3 Jan 2023 19:14:26 +0000 (UTC) X-FDA: 80314438932.10.CFDC956 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 476E920006 for ; Tue, 3 Jan 2023 19:14:23 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=nBNsu+oP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QFewjOTF; spf=pass (imf13.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=1672773263; 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=EwC5Tm4tgFzepPQEIJu9ctB3QRjFntVvmEbyFza6K+E=; b=xRDqLNMCp2768ayiJprnMtr2vBTMhMr3ilHFRCWwopZ/VSYADwPArFXCEmXF6/7Ci2OQIV UaAEMf1d7ogii797Tc0V/msV4q4NABzMnrMlZhdA/ovgrLK9DdcpmfFHrw71moHeVunt04 z4dVE5wJELyAYy60SYehKeImZ5SMCNc= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=nBNsu+oP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QFewjOTF; spf=pass (imf13.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=1672773263; a=rsa-sha256; cv=pass; b=uvvFOK3RIseJ4UPzRAaa3w3TsspEgcM0pjZvvq2+QvrVBXigdVqYpdVF3JabP427bYDBxa 8ka5FUVIorPQrq/GuMaTFitFYkqx0Loih2zltvZEK1d2QvMyABEPTYgNlBctyoo5yL9lIo 5amLJzzZHP4+XOBbL4H8XbSWoSs7JUQ= 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 303JDwAZ027905; Tue, 3 Jan 2023 19:13: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=EwC5Tm4tgFzepPQEIJu9ctB3QRjFntVvmEbyFza6K+E=; b=nBNsu+oP3XPM4qMCBbKkqxzkB7okLIRkPYeUfmSg+WbqO2y9r92FsI+D1z33/s8Tlgm8 83RW6DdqFLL3tvHu0LMKsy4PV2JDECF3WQ2fjiPk5/IfuYpCBusyVsKTRfPiaK1xGRuZ w0GbMLTYfGy2qrHhVS/yNARcClSrqE6gOp+FF12ZmGb8qv8Umi4oPGQ2chbqbSmapv62 X6qqIFpgGkNIDQdsx5GDlx/oXNYsuxyEVtqQlRGZ3Dkpaz+6cel8CMO+GiShEVpSYb90 xtKSY+pkk6KPC9K0tgVRK3CPG7M0g0mkjZoILT3Es64K+2b3/qewN/w48gCrS9ZMiXoJ 4A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtbv2vwxq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:59 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IOtmQ012258; Tue, 3 Jan 2023 19:13:51 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2170.outbound.protection.outlook.com [104.47.73.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58pxg-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+RsjuuuS1WEOdWuqwdhnTIT9HMc8HOgDZawjlvY7TiHGMPfpxLF22omtGxUsx33DOYbwQWfy4UrZiA+mXwyMQXAsV1Z9A7pJGrCkUO/JnFN2U4J8SDFr3tQOr2kvrVG+BRPntK/UWaFDpiBK4AFI2bCJiWn6k2LF3qoyKDqK7ZqP5JSCeDa8bEg6oCDl944UM3bl4+0wOTqLtgwgxXQ1EXCh6MOSvutnDUzz4bUjCBuGdQ7H/VdlDs0FQu2eiQn2anAn1adOIt+Cg2QWrpeRTu9he1xn4wF/dB5qOpJOUIy6i2qBiYRrrmFBgU3gAGwr+NBLhEaODP/H7l2g2d9lg== 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=EwC5Tm4tgFzepPQEIJu9ctB3QRjFntVvmEbyFza6K+E=; b=VFxU3qe4B+FsiCHYTGurhVfP2Y3RzFSlxAmLhx4qcfZpVUd5aeso+sGjtNAS3XDSPHLdjFo9JfshZ/Dkqi7HtRGrFKviygsgXATyJdLzNwXPSjwVI6JFxw7rHRNvNrwrXpLJKCcp8pZVYy3Db1dWX8VUaDRwzPl3zv6oW+0nUs24omq4LIvXR5F0KTwNvwiYo2pM47EfM384Cy37KKKd0EZlXh3AzwlVr3O+pyLtBdkPel66u5b6C4ZHFHYcSu++CROkcx90sXh6i5umOoDneVIrCQbYwsEryINUzXLbbvwJr4UN2W0H83Q89Xp2daubbkBRZyF/Uw/k5i6yWhBFQQ== 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=EwC5Tm4tgFzepPQEIJu9ctB3QRjFntVvmEbyFza6K+E=; b=QFewjOTFIwHVKfwMF9uYmZ1FJpJz6hZ+uKMScdThPdK4VGgnPL6DEvvCPav0ysgUyVdxbNhoWba+PnBvRS4CbABjq9yc+40BLNvK1l1hZ4M8XHIIsSt4SS7lBTakh4vDDA8hDCQ9PaZqVb635R02kammt5mlKyOMH5ghEnALtC4= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:49 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:49 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 3/8] mm/hugetlb: convert dequeue_hugetlb_page_node functions to folios Date: Tue, 3 Jan 2023 13:13:35 -0600 Message-Id: <20230103191340.116536-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR10CA0023.namprd10.prod.outlook.com (2603:10b6:610:4c::33) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: f64d99a0-55ce-4e43-92a2-08daedbea4bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NEl55aI6hzNJjAEIcnB5lq3ENrgvJkwoJynAhqiJb9kNOmSaEq7ixbejRhFkdNMq0WAO8bJ/RQ2malI/4VjvQgQZxAWvwuw8fzFuzYqUEWi3NCsR1dhx1urWOGOJhcXVUWkShzBHmDb5UD+vgrvbA+SzY8dUn8CmKD9w9LeC0m852Prs098hCTMvGdkluKukMa8RKs6DL2dsP+AoOl6T8UKk/S71G5Ha983s6MWH/CqaEMkY/A+/3GiWnrD3UzfbmqfVeZTkDDOYJjefuchyMAAtgsqlNCmQIuDHsscdj3iHhnkP4XEEfbad4EfzfWcP8Fj5Khxx9cwsKSFcj2Giv09HMXke2l69M/A7KHIP5xYU/vbzoZQzsHNtYPCGvRvg3c+10XbJLSnfYEF1HffobGUQmWHLMejGUo3TosV1EYbpPcS6unjaOGxYAcKiPgmXimkL/NUAqXsq9beP1UfpmZ4kT45WVs0cVIBP8d6EuPZ4awrziCkQUD+1AgS/folo3D+j3NP0Ru1Kvwv4Z6CAAFP0PCMIeP+XD3GGxd1P0Q/QtJXN8ZBNP2Dasm360fUVqtoOc3DIHXWJbUEqXK42HRIIOASOMjpnyziWz8LdbQU8sCf1ksBtDqfNqxEO6hWRpWHaMu+3w0I+A4APdUDi5HRct7F6uiiY/0Sk+/MwrXOwGzBsSnbs8QUOioF1GtfX 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LWj/Kt8uqfZgktrCSqF8sQgRMsTzJzUYR1ikNHAS1dLfQ5C+mhQ6yjGo4/54V/4Jof8p+FIYU6BQZsAzxWgPFLHIPc0anHw0mWjUIkTswR10dixW1z7XXT3GnssfqWOBH98ZoDoeWHBOCsyy0F13rgqsPGA/kSM90nsPzIiwRGSpRbUj3Rs/Tjpdnuyn0uD0C1qgMVxTFNPWpUtfisfkeehgHqhVaV0uVBJhEyggeBAGCy4li9gxLnk/uCO0uAnQC4Dtpio+0D4Q8R4pKKaZveh1P545tLvILhl8nCqp13uyEenjJoi5DEwToawLomP7TDR5PXDAO1fHNFmNnONguTWBOL6E7AKdG9M2/doKoPYbwuW8iAC0CNmlzmWFOyG6yz6/qo2wmFWS6ZTO8YSaWFS2Jpg4zwEFLyoWrye7JagXywoiLk2aC86/1sU6SrsMpj9nOx9fdk2h2OV0NoKrcUEDs0uzhBBGCWCayxPoneV6qPuKW732YpiU8bE0LZyETdIgq714iPbp/tzEAepKryaYb9VBAlWsmuR5z8gG9BDieozieqtyZ/GRCIOndq1zCG1KOCvHhvWayWWLXYFyETWCaeWJbXkhDEBYGP3tlnrVKnUVTR1sIMFb9OWvBSZXJZcQa0L64Z46eCo7NpAdAw7ZV94FYGATadnHCOr0af7R7QE2nLqSDHaSVOBbByA0tBIIoG5Wlho2LbWar1EaOsAmxElMGmuNPIopy4jdQ2c3CiwzlY9Vt0HI7oMYTFbxOwkiftqjQUssrUMyfVmhWfjqfyZHd2hDB2bG+MS9pGo4/xL78uir7q3JhGEQXJKlv1MEmNHRJGEAQzNc7b7SxO+wTQpz4Cld5s+cEM1MO7yfCJFNYQIhsxo37tvyJPeyvaQs5Xhos1QDm2lIRohjpJ9UxCG/UuUQcDGvmebRsSYgW5xDQ8Ib5oGd2LZ5lyOAWhCw6VoEhsxvuUG8xk8Tdr5MmOylbfCBa9fUqyAPn49wREiF4OIfuyWs+DIWw9fMMMxKg8zB+U10VUYv/DebjrUwkM/mEgr62Qf7H0Q4ZoI96+AAkqrWmsyvFxGeTOyyZY31ZiAKtPVHAD0jqC2V8TCEVyZE/9pKIo+vZw39TsJg/jRDe9abq7D5TFByrdEGTW3NKmuIXa8EhTsQbCjO5sZCtRS/7hlfh6jW5Z7hs8yM3sCHfm/I6qqjXpeIxDkPodvJCk88MQKBWOUfN99qSlpre1btcC/+J6Hi/ybj998dQYAKA08DODwXua6dDTu2+CAER+Qd6668sbJUzD6IP5iGXeKULwwDZJBYk5uYszvPeDCOBwG2ZUwMlppJ29/a0J/bkN+ysc0Ls9E6Mixp8uNDLs5uipgA7LmyY+A+DfYei2rbNLsNseC+UIkgwIBq0p4OHu168YLIVVigj/saQmZ6X/k/O43nVvivJLjV+R3BHT8J6R023oNaZq6XEvd8i5Mq41c/sl7TeAJOY8kaW6QEOg1TIBrT0BfqDZFBZ1YNi9ArVARhgMljTLwcAEtZkHIpe4rfnGJSuYQ5ImXqQ7rbI/uVqjglZf2HNPXizwwNjLarF8/JReF6B9pG0pIbjQin7iEOOaTUsOaeG+kt7A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yxoTa3gafFucGukwHcFuDOnNCFCy90saecm++RiSypoMlFGCoGmfKrWVXnwGKQOqvlZ+TMgmABQsZPxeRYpyZHDz//rYl8LDwpZtaqOA/y2ardUOZaT9e9/pdy0Q/Nwha0B3beiRH2TlCM/KUErTRQDDO4fb3BAdcUpw1csiPZCXwU93hiu/e42BVQicgLhOR173d8v+OsOafgtOIABczaIceC9YjldfueREdxmuUGZNEDmlNx/3dyEXY6o3QBmI8uALPRNwCuHBkKql+bbmdBhzmZTcMINDaAsClBG9fKaploU8pq9x5sSeuwf0DS6LD0iKIwZ5eso164FeAc2cxO6MkTUpCv8LGjJRuLAQ28QpzL7mAZMeZl7ss08TQBzMdvUTUcNHAlS4QoJteaz2yeUrTsHNZWXSj96CXLomUb2tHgSQDrRlkORlGcrrb6OsGU2S4Z44n4TaIdcq4R7MXCerb/GbkCwKdYm4uXPtOp0n1gKvX9JOJtlUosBIqFQxG7of5w2/g8Q76Epu23xiTBBtH/2UAALBYhitE8MPVaMbiOqiEWw2Ef+DRaKummKN0KEe5l+gEMG4gKH52M6zyU9w20JQSXWYdiEebQ6TpNZbmt2pqcxiEeXI2zawqABV371putGwdm2HHUM7iOR1rB98plT8KDNREiiu6St8mr+Z7CxGXWdcv5iuQs6nQDn+MPss1OIAaIlWZthkIf0poLkcxBXsK9FbWwL1ZBH2kkxRHc0xYMgOFyvXfPhdWzsE85gJugb182Wbitz/QLt0EGXFhhsxGF88u4mcxqD0Rf0WZpZb0S/ueVoCtj+fDjn8GD/QiKqWrBg/FG55IDGyi3zlauW7uncxPhq0f9YUN9FgctspiDFj+35msBmdYfuCYk+THCg6MJAreq9UawoWYgjW83RfU8GoSEXe3qveECSHAiiv8svXvX7Vb5Yze5hofiajzTuTzpzJcCcdtOmWK9VYft/zJGVcR+NQXJ0u1OU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f64d99a0-55ce-4e43-92a2-08daedbea4bb X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:49.2015 (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: 949dJKJ94SLmN+1+5K/tjnfms6Z0RIWIg3dlfQmEbXjDiDKwqJN/cPgf9/pHnoFcOSR1QsPJemd75D8UFPN0YGiDEikwqKyMjYRtl2gFBf8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: 0J8ymEVbajvIS9xvHQIgQrHItO0m3Oj2 X-Proofpoint-ORIG-GUID: 0J8ymEVbajvIS9xvHQIgQrHItO0m3Oj2 X-Rspamd-Queue-Id: 476E920006 X-Stat-Signature: ze1fk7iqim94cj4ntczbohrrokbpfkbf X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672773263-611170 X-HE-Meta: U2FsdGVkX19f1yKOUBEZpOTY3i+YaEaiwqjaCT/jsfLGAuYXJbdUKqRjV3WviabQ3p2iIXoBffdqBdTyzLtGHzq32iEigY4f8lIUdDbRg4D9oeLJ64H3OYLNcgn7G4lYPDe2+XJFwjfQeXu7DB7Air+VaQjMsBhleBNtqzkS2NZVWxX5MVI7vf8EfC3N6evY+vKm1re8s30eeTuRjHH8Bh7c55fF9++Y4zb3xw5Q5rYFrm+z7VQ8uQwYggLzB+7roca192ycCIOmkSVj2rTHiEWURPWThqdCUslJ6h0WWjsRXdKw4M+ws8RAnFjwGONcAdINRbIqRaonV1FhfNtKdgtkJ0GdJCEtLPyza9dwzwEdsTH3QAMYzLvKjgza0qkV2jJv0TNVQ/D2clYZaffKKGH8N6u+/qopqSm25hXQjs6bl21gLwnXdKYHFlPanQundBvid1f+IS2gZi/ryrFuIIr+7cU+ShQaBC02WhZicE7zN2emmnaQbGsIn/qgyZq4cIR+iYTwDtbR8Qd7D+g7c0rphGEQRnXV/e8uTNalWWceL3Ol16qsE2YXvEriKETBiRUVLvlX8eKVQjpbKmhJ+uCURbfJvTVh2nu6+3pS/qo5mJ6Uiir2t9blq5jy4GTBBf0s8FdMKBmhbSvLUb86/A0b/Mw2TgMmuV4/6pF3d6dN3rPh6d7P3KNm5c2LyfWH7isObaeNAEgetqsF2YfWb5WxoA67IR/NzUKHHMhTeuHKtGktqHauHPHJ5nxQsMNV5XricLwmG+XYeWJV/OAPWVxMUe3JNDwuTh+Hcswz+LpCVA4EDAlberdBbgv/6GY3gbWfFom2N4E/8+5G8lFim/st+AHBvP5K/4XDUHjyvUKcjGm6Y+sy9zk9454FN599lxH/ReZ15zcKPUzvH/cuMdAW0NJ/1bsJi219gP1D7nK3wxoe5PSkej0X+e0XnGvb62rO82YyNrs8Q5IiyPd XtZvAqTy 7F0F/0mpYCOUfnhL/TOKbr+l2NdgAPuwThcOp5vjALTDnytj4Xce5/1w9IKWgvbTbttgfLl5Aegez6YGlAQEOYqndc2vGGwMDXCMctgozu7pVRsluoMg7alZXTqdc577kCkFOKHtw7teklqkqX/G0ge32Ow== 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: dequeue_huge_page_node_exact() is changed to dequeue_hugetlb_folio_node_ exact() and dequeue_huge_page_nodemask() is changed to dequeue_hugetlb_ folio_nodemask(). Update their callers to pass in a folio. Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 55 +++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b06ec8d60794..8dffb77d3510 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1140,32 +1140,36 @@ static void enqueue_hugetlb_folio(struct hstate *h, struct folio *folio) folio_set_hugetlb_freed(folio); } -static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) +static struct folio *dequeue_hugetlb_folio_node_exact(struct hstate *h, + int nid) { struct page *page; + struct folio *folio; bool pin = !!(current->flags & PF_MEMALLOC_PIN); lockdep_assert_held(&hugetlb_lock); list_for_each_entry(page, &h->hugepage_freelists[nid], lru) { - if (pin && !is_longterm_pinnable_page(page)) + folio = page_folio(page); + + if (pin && !folio_is_longterm_pinnable(folio)) continue; - if (PageHWPoison(page)) + if (folio_test_hwpoison(folio)) continue; - list_move(&page->lru, &h->hugepage_activelist); - set_page_refcounted(page); - ClearHPageFreed(page); + list_move(&folio->lru, &h->hugepage_activelist); + folio_ref_unfreeze(folio, 1); + folio_clear_hugetlb_freed(folio); h->free_huge_pages--; h->free_huge_pages_node[nid]--; - return page; + return folio; } return NULL; } -static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, int nid, - nodemask_t *nmask) +static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_mask, + int nid, nodemask_t *nmask) { unsigned int cpuset_mems_cookie; struct zonelist *zonelist; @@ -1178,7 +1182,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, retry_cpuset: cpuset_mems_cookie = read_mems_allowed_begin(); for_each_zone_zonelist_nodemask(zone, z, zonelist, gfp_zone(gfp_mask), nmask) { - struct page *page; + struct folio *folio; if (!cpuset_zone_allowed(zone, gfp_mask)) continue; @@ -1190,9 +1194,9 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, continue; node = zone_to_nid(zone); - page = dequeue_huge_page_node_exact(h, node); - if (page) - return page; + folio = dequeue_hugetlb_folio_node_exact(h, node); + if (folio) + return folio; } if (unlikely(read_mems_allowed_retry(cpuset_mems_cookie))) goto retry_cpuset; @@ -1210,7 +1214,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, unsigned long address, int avoid_reserve, long chg) { - struct page *page = NULL; + struct folio *folio = NULL; struct mempolicy *mpol; gfp_t gfp_mask; nodemask_t *nodemask; @@ -1232,22 +1236,24 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, nid = huge_node(vma, address, gfp_mask, &mpol, &nodemask); if (mpol_is_preferred_many(mpol)) { - page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask); + folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, + nid, nodemask); /* Fallback to all nodes if page==NULL */ nodemask = NULL; } - if (!page) - page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask); + if (!folio) + folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, + nid, nodemask); - if (page && !avoid_reserve && vma_has_reserves(vma, chg)) { - SetHPageRestoreReserve(page); + if (folio && !avoid_reserve && vma_has_reserves(vma, chg)) { + folio_set_hugetlb_restore_reserve(folio); h->resv_huge_pages--; } mpol_cond_put(mpol); - return page; + return &folio->page; err: return NULL; @@ -2331,12 +2337,13 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, { spin_lock_irq(&hugetlb_lock); if (available_huge_pages(h)) { - struct page *page; + struct folio *folio; - page = dequeue_huge_page_nodemask(h, gfp_mask, preferred_nid, nmask); - if (page) { + folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, + preferred_nid, nmask); + if (folio) { spin_unlock_irq(&hugetlb_lock); - return page; + return &folio->page; } } spin_unlock_irq(&hugetlb_lock); From patchwork Tue Jan 3 19:13:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087913 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 2E303C54EBC for ; Tue, 3 Jan 2023 19:14:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B93098E0006; Tue, 3 Jan 2023 14:14:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B42AB8E0005; Tue, 3 Jan 2023 14:14:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BCF98E0006; Tue, 3 Jan 2023 14:14:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8A0218E0001 for ; Tue, 3 Jan 2023 14:14:26 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6BBDCA0ADC for ; Tue, 3 Jan 2023 19:14:26 +0000 (UTC) X-FDA: 80314438932.11.CC61E3A Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 3F3BD40002 for ; Tue, 3 Jan 2023 19:14:23 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=wSeRFYur; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=FfV9hhUu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; 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=1672773263; 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=Q/ely+APh40QA7PIqRoFk6Hlp8rvygpoGpgybXM+zlc=; b=cgMck9/quYOEs/HAJbozAAcO6/GbsYnNoVuXYF4iy6JiHEqYpRnT0alDgJbTnXtRlR2keR iMowcstuQvRC2KD0xWZiN63Iam9kTthagUnJiCBMFWuFiOd7DVwJb1YHNCLudrXzPW3xNG nHmBYsHTh4kMSx/HIPvkplEOwK1sYZc= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=wSeRFYur; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=FfV9hhUu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.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=1672773263; a=rsa-sha256; cv=pass; b=hBTubMXDm+NC4PYY0nHX0OUd7HeHSG74sLZ9u8ZUOxXBH8tDdV4K3JfQszZMewWIh+/ljd ir4NuqEKHuxk6IV7Dh8Fxwec1JMjEkhdmTDvwKSHUjVvPGQGRKLCt+vUJBmSEMLWpv4UHJ b61n+1jH8QWRuyvKEpRPuYCP/snRwLA= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303JDrHH000987; Tue, 3 Jan 2023 19:13:55 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=Q/ely+APh40QA7PIqRoFk6Hlp8rvygpoGpgybXM+zlc=; b=wSeRFYurYteDdqZqD4bubFhhzrNE3LSDIew/fnoFzF87LKWa+iOF+4rzkFxJQIJtpIN/ qFfG1FWmy/GcV1fLw9HCFAtRHOAiI7AuZSRNf4U1Wy9Yi9o+kRLlXh1EOESFzum6RxRg +WiR8QzmDiMfuYDHZdrz8BPgnPedZBhrmud1nZrpBCDFpeHncGZU5V6QMlpjUhlanwLo b85cieWo/lBoZeZXyCTRrB8jyoxiShsvRloeoAXi4R+ugFf26F57aAavfaPLgNnt+OnY vrDIc0lbD8SbuPI9cW0WN1emKilLlgdVxrbJghphi2lYrBtfKo7t4rI9V4MbgXUigsRM 6w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtbgqmxhh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:55 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IUVKv012246; Tue, 3 Jan 2023 19:13:53 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2171.outbound.protection.outlook.com [104.47.73.171]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58q0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S7ri1QMkjy0cQOf06EdA58Rqn7cCczV6yWT3AMrrk9fUqSH3BqA66JAxejUaEtFyh9UU8LfqFomz/7SmPENURVQv/7qUIJRw0/dEnsO7uDYUU5RW1BxNM0assoQRrZIuacol/d7lcLCxT78fw26q3LWJCFevztWalzfoWCicnQt/KHTEYc3K7h/5ZIDxrHyu38Nrt5NopLC6sD8FdwNPXJUQoidZqRDw8jDYnnJz1zt8+FObfaveAhbYIsv2j/hDuRwzY/nDQFKF9XE/2ZWcUW2JbxP8bdIQRfc3gqxiyQwgEf6Z4caTuWUpp2xAwOovPRCPMKoebifkiVnOzjDc4g== 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=Q/ely+APh40QA7PIqRoFk6Hlp8rvygpoGpgybXM+zlc=; b=Rq4QM9CHrArbcKI2d0WQfYksRsqe1T8xcS6fVMeRfovpf4ZCd1pit8e/whLgzzT2ns48jlGgG5YduP1QI2M2bxjOPqzmgMMAuoPwGFqJV6Igg2fkvOadUGkjL224gJncr28cljQcuh7e6WfQUaZrcjLagTT3iDC7qcuvqCjPujth0tMUdiHVhr27OZ6Vp0hMizHyNZgVAXPmURZYbv5HtcglYdDfByaJbbSKMghyOqCBf3sizLwXhfG863uoyhCecbO/c5Hks9qT63WchLXnTYig0OqXElT1ZYY5KILiOzcobfPf7FyC7R+U8+uz+OjxuYwtoudo+MTE21RHhJr8AA== 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=Q/ely+APh40QA7PIqRoFk6Hlp8rvygpoGpgybXM+zlc=; b=FfV9hhUuoKjiZyou9/XNrX96nNorkGh/RlQls8W9imPQSgjBZDrhJjqQoANou9bS+hvCeYf7u+7Pg9ousd6EXoX5aBAfv9qpx3G3nDoORQzjDwNFuv7ZiJKEGm+C9DqrdnFOgPZG6HnjIDsseV6750Tu+NBfESvKxoJiDX6HW0U= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:50 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:50 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 4/8] mm/hugetlb: convert alloc_surplus_huge_page() to folios Date: Tue, 3 Jan 2023 13:13:36 -0600 Message-Id: <20230103191340.116536-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0449.namprd03.prod.outlook.com (2603:10b6:610:10e::25) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a5ed562-826d-4c18-d821-08daedbea59b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pMr49GoZ7BWorU0vfjdPjXH97CT/DdOju/5eOWIQGry/9KHrrjWGqcHUPgYYUveKC2KFYg2/CfEfvjfWOLAA5lQIVd+ztuKf4tOo33/ha76ndRm5Ctqd/YNsDN+vrfk2S433XihLKU7eHgEZM2gcTI99/xNUuJjfD6crhF5zxJY/+YNrV9FZKCozTSdUMk6cjQoJJ5c6yrJofmk8FN5xznNEQEFXeG5SGOI8Ujw4MS8hiEUxfNcM2P2T3aKAUBMO152KFUTlfe6GejloWBAf4dsGMAIyb/UwyB4A7YWdYWgadgDpDmiTtXq1zBJsSAgfNEXzzvj7jGJeLji81Sb5dBF8xo8jcuOwiG4R9TpjvQ2lZyR4fA8tW5Uq+fuU3pUrS5vcN2LDtEOPQbsqM8HHCVxecFBw4HFu+a4wSRzELznNIZQ2Va4EaTvntCqcMyrdr0+slXlxLIMrqoUYhC0I7TIjFnMg0nBq7fWGzf0L6cdciub77elLZD4ejJTgf74dqxIWRTmENyzTan5df9QhhXaMu+9ROn0IES5Sy4IMDbplVJsY3p5UWmQ1uZkrVuCZo4Ly8TEaMFpwIj2tF6kpWHGEc+O4RewlAYQSE02RM6pqrzaoYXBG2UD4jPIc0z+7ldcPdEjnt6Q8659phHXrr/NPaGSChRKz+YBXbKEVZ3xpF0xMkuU/RxYSGR34N/f+Z9yQyuk56xT9QnUg5Q7KkA== 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ufvHpW/OvHRC7UphAjvaBH6FrpvwjitSPQ4DmgS/5GXDyt//NsAvFjAZCQkW/KirRki2Ta5rf7JgsWPRbhtYbfdwLnUzhwQXBXFkBhWQOQbKeTHK+5y1FQ3fN3cqwqjt6iUo0JoDcCml6V28VBgM6T4q/C9hedCuO0I5RjHXftNZ8jf1KlVCR+5Vh9cpte83CXayxi2atDYZ3C7OElHR9/AUocOKhwk/iQqdhXYB0goazU5oLJ9ydPaUiapNYhqqd+ML7uOAOTM/uItTVzB0oAJQ/QgO/ObEqfgvXb4yKq7UOQvC3SEB/miILnu7dEkw1vMQn4mmRnwxpw6Pk8ebBdI+Ti6lOx7b8NuScpP4EZqVySDwV1aZaBrrUzrVEqWbRmPkL7Pq2YUdAmSg64iFNQj0mkjXx9hIAoYQy8DL7ipeGCBlbgNMyO18e33gTAF43sPmTqmb942Wb5QVQ/VYO3b+NrR2MAanFFnWHkLGyNfd/PbqzEcjqsTX29yrEhLzHwUrOdyk/DDWhRhVSyMW9Gf+XmQCZrtwDo1Gr6UTtjXHe6uaGUvZeluAzZFhoGtkImHwWpzqkByYtMEO2HpDpfYlwzPbdp64dmFOo8DSX8EQaVYciQVy9m5nCEi9xdLnw7DeTBMp5T7yNutYhyAgLXDKZxwr3kFHg4bHbiXUNdzGmb/LyfmT94t9WlSF6hSYK6zdUAsbZtnIJaL1fVfj3yDRYdeOOnCOFk7eUiUMS5+VMWGMctSb8PttCXM2MZk5bDQuTyQSYr5Q5ifefx6iAP8O0YBV02UkWLBcVPuM0+zcMBR1deVcZcKb92yjU6qtvGmqNIFonZawj4WSugB0pYyju51fDMu3TZ5yjvaxrNjfkG+asm3jzx30wk5tZIv3geU8JYhoNF1ph2ZT/iWol98c4qv91c2gdNd5raTJW/RI7mye1QCayNuCAx0+UcPAsO1soMvLPk8pGr5432bsmaxAOfnpizTTwrPhQ9nmnqQttquAXwRyDtYcMzg+Q6pSV2GT7N1UvFhDuD7oa6Q2VO/oGSkcS4P544foaBDjcd+DBzo1zoA6fE1HlxO4v6ASuLLdWYFd6zipVItyXJlVQDWG0A352qrpAZwA/YRvBZEKJGfWwryb3LLV9Xd0ppYrjwn/vaJ3GN1nsV105yzCABA8biCENaiSonbw0qJon5uUrzbsfGgMzXS/nnz7DRVD6zDdK+xS9p1Csy5iDfzjSD90DP6ygIkvoo+9VX5tHzJ81gEn3xn2keKBP0+J61PzPDB/4PCLXDUWGujEhv/NxH+0XXhKBb5QXFTN6feZKpzogZRTQcwYRA+HjK6HBr58ns2Zllwn3t6L7kvIiDj7MlnW6uy5oy4fDiddk+vJVxT6EQbbMBKWGLytGFB1OPbFW2XHk+RWG7yup+cs/+iKMIm/REzcpBtsiJIz06xLF/a7AVqgW9rE7yNRiNGBYvWJvLpmWIe2WMlxGpskggmWtEc/1kNVME/NGYTH82mJ1v5/IOg25/Up1MX7AOI6Q7M2pfCDmGC8I8AUfbqEBn6OV7fCPu9hFZoAQQeu0q34eHD+5xUJ0/RZWUNBs0Ura2zpMnAs14KYMTME44O4BC98AA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: eCdMklFc9M6fnK9Q1Q2neALlxe0NP9mWv7mkEVr2KMCWzCiDZQbmfcdv8yLPJ+b4X1VkhLU90Ep2J/vaMGRs6H6OvDfMhfB6ca+lC+kmmC2gKxrawfQMsEf8RzQ9Cy0M8P+w+Y12N5yMZh92+35wMoWN47sUUG/Z3eG5kzdN0citP4AzX+SL/EzgbvDCGfoz5Ll1CIhFJScS/xEWPTSJUA6gjxI+IcR7CuZ1uyCtFldl+MehPqcljKn0QmhlkUDdpkr3vp6pAt4QutLff2XDs9RECoRNp6fKbQwe9iFwE6LeSjAP9zPI/JGqd39qnXmjRf+e/LFaJOkiEyIUUzTNTwW6zXUXKGWhymXdLF8aM1E+FHVPteMVUGI9ispRxtuAJhQWogknXwcZSts9byTm7kJrk1zy9Q6kqdms7cWaO7bUXNQUCQQvrNUJPmNZegSaVeiYLAN/fjAgnpgZWRIX+/9NyswAuzUlAclQeT2ZrLeltGHYzy4RfRndiA/83w/ID5oHBxOtcHvnjsQ7XgM1gK2VZsg4fLCiC1vTSdXzHeOJkVgo94t05JcwZbTaWySlkU+Tt1iYjdvf/g5LU8CCXG49FIDCIjVoWmIeIQOHUfin2C5nRjn37Y0nyiyugDhIaca76pal01d5b8hgt453ur1HTtffG5+AjXFc0Y3Uarr91U7FhDcLRXfdNd1xvWdSfK0TUKFJXk7o9bPmTUHp5/nGU14114wZLHBxSEzTiCEVWhY1X9UM7u4DRf5Y0PKYR3DcQr+mQL8pyuVzT+p5QBjuotQvjscRGd1hCne8/7VP7/vhvAIK7zQ7pJCcXhmGC/yELKuzo11ApsJZZnGvqQyU5K4EoxykaK9AC8DSUDS4IR8dFSeGoj2dvGmtBHJiwssUH959hJd6BelRX0EZjqAE9Ad6754QHu68g/YGoOHSwGO3vqRirNWYqRRz+vGzxPf8CspXuiB0Tru6R8IW+wYCA1ngYTtQjwU+OcGf8Wo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a5ed562-826d-4c18-d821-08daedbea59b X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:50.5775 (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: xMBz6xhX9YgqnjbGyI0VV/YMk++zS/e/WMgE4CD8tbJfJ6InKq41MpgmeQaHQ9Huv2NzfXbM2bX66JTmNU2h0CByiB4i0EMEIR+ya0ONSXU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: 0sLC0NNNmPn8gAthqaOjsS7y9KAfyFFL X-Proofpoint-ORIG-GUID: 0sLC0NNNmPn8gAthqaOjsS7y9KAfyFFL X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3F3BD40002 X-Rspam-User: X-Stat-Signature: 5nypmtzc6s8gc6qtuukuh4yxrjrhiaq3 X-HE-Tag: 1672773263-481201 X-HE-Meta: U2FsdGVkX1+uLV8jwchL8zX8Ia0VYvX+Ji2CShpDcL6yUUuh/ZZsFVPQYe7c+TZCg+TZ2p2qrRU2JUk97G4EcGxv9KKq58gQREFE3FaDJcMBbf9Covm24Iooq1HQ044iBcJf6bG52GE1/hGXGj6+/EtZBM0htdYeSQcDipldTtXZAo386jrawVYIZLsx0ImckQbyiEGDNRM12qFDHf05PBYLEzOcNdDrg3VcQwUrzOXNLHYakohxvjsIQkBqllksJxIDP6dlJM/+V2SYk2NG72HY7y9tlTxBiatoR+xo2zIdXFhhExHwcrpDqMHNKj3msGH+3+2zKwq+Vlhk+4+wAhr7Bt+bzNjjeSQCoGxYSras0B+wlMA6Te36UYiVHbGpIbjtCSvIUwBKVEvdwlQ/LObDbY8bDl5JGWBTJw0SFzwSbqTHxdEfHR2dumcql0UdmlChRTQiXYARqomAn9SgTCdcElNFCZ4JZ9ew1Ni1exADbXWl5sqlFTXQ99uGAfAyNeSu7++x0p5ILszeIDDKu69ysLo0npKbxb9HALHHFUZFxVnqIs+H6U5SIhpTIbcJ5ZJ6Nu1kI10X7V9ljCNV8Rstl5yO+kTezgSgCzzk0HhVZL8cT7h7h55UL2HOsuAKMJ08mJYp0nufSgCO38ZKCV4Rf94tRUP7EpB3CSIZYwQeYo+nkqZ2pVjBa5KJ0opfQbAlmm6pCGVpNoSogBF7XWEwNrkevM3kuJO9i0cV6ITfZiwRNzxu3Xxpz0BdYC840A1FmQb7viq6cZ0x/08HdLHjB9DXwGlfJMv2iYwyANBHdh0D3oH8OcmoXTV25cboiDVo8LGvkVRLH5wGNPuglM05mXlZGOswY3i1Zqp+E9S1Oodia2BdgwgDSAVNsgt+2tleolXpJnU4PINVLuM/hfzwyz9eswx4sWx0SNgi8Hr3U5YIVn0NKo8Ieh/xb/zl8J3UlFnF0sv4N+UKKDK XD04ecsp KkhbEkvs75LBn3+OWggOd/kj3scl820tMWAo5z/6DEmwechNd413beh1lOzxZBN7rMhV5yeOItMYM2Xdpl6k4RPB2G+18k8Y50aWTa9KPncFz/luPqsqWPQyLOn3WHAAGKg/0zHPi757ioI0= 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 alloc_surplus_huge_page() to alloc_surplus_hugetlb_folio() and update its callers. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 8dffb77d3510..0b8bab52bc7e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2237,8 +2237,8 @@ int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) /* * Allocates a fresh surplus page from the page allocator. */ -static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, - int nid, nodemask_t *nmask) +static struct folio *alloc_surplus_hugetlb_folio(struct hstate *h, + gfp_t gfp_mask, int nid, nodemask_t *nmask) { struct folio *folio = NULL; @@ -2275,7 +2275,7 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, out_unlock: spin_unlock_irq(&hugetlb_lock); - return &folio->page; + return folio; } static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, @@ -2308,7 +2308,7 @@ static struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { - struct page *page = NULL; + struct folio *folio = NULL; struct mempolicy *mpol; gfp_t gfp_mask = htlb_alloc_mask(h); int nid; @@ -2319,16 +2319,16 @@ struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, gfp_t gfp = gfp_mask | __GFP_NOWARN; gfp &= ~(__GFP_DIRECT_RECLAIM | __GFP_NOFAIL); - page = alloc_surplus_huge_page(h, gfp, nid, nodemask); + folio = alloc_surplus_hugetlb_folio(h, gfp, nid, nodemask); /* Fallback to all nodes if page==NULL */ nodemask = NULL; } - if (!page) - page = alloc_surplus_huge_page(h, gfp_mask, nid, nodemask); + if (!folio) + folio = alloc_surplus_hugetlb_folio(h, gfp_mask, nid, nodemask); mpol_cond_put(mpol); - return page; + return &folio->page; } /* page migration callback function */ @@ -2377,6 +2377,7 @@ static int gather_surplus_pages(struct hstate *h, long delta) __must_hold(&hugetlb_lock) { LIST_HEAD(surplus_list); + struct folio *folio; struct page *page, *tmp; int ret; long i; @@ -2396,13 +2397,13 @@ static int gather_surplus_pages(struct hstate *h, long delta) retry: spin_unlock_irq(&hugetlb_lock); for (i = 0; i < needed; i++) { - page = alloc_surplus_huge_page(h, htlb_alloc_mask(h), + folio = alloc_surplus_hugetlb_folio(h, htlb_alloc_mask(h), NUMA_NO_NODE, NULL); - if (!page) { + if (!folio) { alloc_ok = false; break; } - list_add(&page->lru, &surplus_list); + list_add(&folio->lru, &surplus_list); cond_resched(); } allocated += i; @@ -3355,7 +3356,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, * First take pages out of surplus state. Then make up the * remaining difference by allocating fresh huge pages. * - * We might race with alloc_surplus_huge_page() here and be unable + * We might race with alloc_surplus_hugetlb_folio() here and be unable * to convert a surplus huge page to a normal huge page. That is * not critical, though, it just means the overall size of the * pool might be one hugepage larger than it needs to be, but @@ -3398,7 +3399,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, * By placing pages into the surplus state independent of the * overcommit value, we are allowing the surplus pool size to * exceed overcommit. There are few sane options here. Since - * alloc_surplus_huge_page() is checking the global counter, + * alloc_surplus_hugetlb_folio() is checking the global counter, * though, we'll note that we're not allowed to exceed surplus * and won't grow the pool anywhere else. Not until one of the * sysctls are changed, or the surplus pages go out of use. From patchwork Tue Jan 3 19:13:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087918 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 59607C53210 for ; Tue, 3 Jan 2023 19:14:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 88A018E000A; Tue, 3 Jan 2023 14:14:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 837008E0009; Tue, 3 Jan 2023 14:14:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C4BD8E000A; Tue, 3 Jan 2023 14:14:30 -0500 (EST) 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 492ED8E0009 for ; Tue, 3 Jan 2023 14:14:30 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D26FEA0AC7 for ; Tue, 3 Jan 2023 19:14:29 +0000 (UTC) X-FDA: 80314439058.16.F3066B3 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf23.hostedemail.com (Postfix) with ESMTP id A5DE2140003 for ; Tue, 3 Jan 2023 19:14:26 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=N04LDY8M; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pxhrLbbG; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf23.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") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672773266; 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=Fo1RxbKBNEh+3O3z+QHKut+Np6Q7TabFfVnFvfxT3m4=; b=OBp6Dv5axjuqxT3YO5bI+8xWDd7c860IaSU6SNXMbZo+i6UeVBMO4a55uc9hCFgxfNZyrz EOho4fLUM95zf2v/oHrKI+5QXY18I5tZVepoRRc//SM40/1svzO9VcJjHIhpiuogFXoYzv aWhhJY3eZuNeUqwL2mzrU77PQ/IaCyA= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=N04LDY8M; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pxhrLbbG; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf23.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") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1672773266; a=rsa-sha256; cv=pass; b=oobNJ0xq3XrS5fBjAL7w3LZmX/SHUHyeZ1ghUHa9B/Tpsd/VT9RUOhAWbnKX41xcqK1Csg 2LSnmQxrGU6qHHxqv+NbJXMNqM1qkBklgzEkKmI3nliuwdUBMdww0h9j/PvV5TdWn7Yj3C 8I3EFipnfFTtTYvySLJWfILD853xD7Q= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303JDsTk019208; Tue, 3 Jan 2023 19:13:55 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=Fo1RxbKBNEh+3O3z+QHKut+Np6Q7TabFfVnFvfxT3m4=; b=N04LDY8MUQExjChVeNA3rObejVRJDYoC9iMKq/IN3p7OvCeGzvEjcwdPx1vCyOa/7QNv WOJQ2NPHbart1X211pXY0d8bHO+87qFZ06vhhf//0HzL46Onh5MEoQj4StOoWevTP13+ wa8xmeEGfalx5nHtknwQb2ynB0zmqHBbZBArgP0DnrTE5bAlr0jQ87PUTZDCVLEVPk1n 72f5XrC6KnvvVfI2TJi6wpz4t1ji4m8uYveaoex5/H/EAcxsNvgmON5aJNXNbSXRm0kL l68lOhCjQDet9OA3K1YtgDwAjdTTKjNb44ndvusGCzTauX9QXra9ZenervFfji7XBQrW 7A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtd4c4xs7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:55 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IUVKw012246; Tue, 3 Jan 2023 19:13:54 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2171.outbound.protection.outlook.com [104.47.73.171]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58q0g-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TBz8r5XOsvWRBbhcyNKYI6WGPS6wbpJgmE8TRyWlTSchasMfNU4HiNx55HhNPeNgH2QYLoxqSAZ2E2FDU2CQ/2zbURUQhantW7mD/RXAjAyoF8QbgLfSZVvvQGaF/7EeLn/mh6dyOp6Nv8/TJ+pnIWtYsTojcjfv74B50isuBqXfFO7KzNwQ4XiBoEX1uxEnstJVE1tEn9PQz2Isf8wjPY/42HAH3Z14nheTev4/6FWvokIJrqnIdchCmK2sc63nLN3ISmG0cHANR1/7Loe7LNWcW1ql5GAl+0hJDntBH/nrv8mr1kjw6wSz37mzqZWd6wtmzpJutsel8yPZwjsz9Q== 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=Fo1RxbKBNEh+3O3z+QHKut+Np6Q7TabFfVnFvfxT3m4=; b=CX4AnSOa7XIvc97s5UsIcCXj7htdIwNhas3RSZpar0WcqQhND5Ns1UTCWkCCxIK7pjfidbMDqYu56fD84JOhldUssKek3ClRNiqSIQJmeCrkKOm/u+BetcCvyMuvyymeJ1JnC7GlnXMqpgMWJkRKW9CpTl8fAUYdXGpooETpWXQvpxypcJ/cbEf4VAEpkZdz7J7xpXf+IlRdMjvc5NuITMHESd3aTmon1VCKQcKbVCOKwbc4WNgejOp8Sjgkt7Pn/xZfKSKIi4De262PbCaqL50WcwvEBRAuYe5PZWo+7MaVkzlHWo6VpFmX8WTMJCiFT1XHNP4QOucRx+K8fjJUJA== 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=Fo1RxbKBNEh+3O3z+QHKut+Np6Q7TabFfVnFvfxT3m4=; b=pxhrLbbGlZRfYfNSKfvUASqptX/FqYGAFnEDf09etDxW+fQHfsK/IdsTUWSKuW5JGP8U9WjUfAfOTVXKhriCx0Lzuhwk5g1i9br0HhyMi7n8icj494STgwrgCqOxtobONIWpjmY0e0dFceiQpRxAytILfPS9RND/uxT4kbgJPMc= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:52 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:52 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 5/8] mm/hugetlb: increase use of folios in alloc_huge_page() Date: Tue, 3 Jan 2023 13:13:37 -0600 Message-Id: <20230103191340.116536-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR14CA0031.namprd14.prod.outlook.com (2603:10b6:610:56::11) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d3946b8-6bd2-4c01-0d07-08daedbea677 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WhReCw9s5ezZvLdsxIolhaozI35mfBrm/mrKXao66fkL6i73M0L9L6D84oCR5YrJzEeb7Y4tNyYq/ldKXqyaqdftL0Xe3+S/VAS/3lgJUMIu25vSXq+unsn5m7p02FpZ++/horuDmCidIzXYEGWQfEnHvUiS/Hq7NIEh19erW/7W8WHflVf2Krm1+R4ObiGdIzPpAgvglXd+D9u1Oz8LNnGcVa/loWGEqOCTE1hQoGciJkYyWIsZe2G83AA5mXGLx08/36iQn4XuW5tO99qeVkYsFoaOfI8tQ9ARmr+5H2D1QYZQjJGYZnfBtkC0U2aD1YFFXJkLOYZhZLEem3a8ZKisAG6D6v9TNjkL5sch2M98Em1miWKfZMaRf5ZYkyR95sNQ7wy8gTEcXXSiqY+a92JGhoNaOXJXxlLZww4dLKNNJtE2F39/7iv3aKucQb0slnGmrkU6Vl0fST1yL3IGVI+MyuoYhi8dJQKIa8nXJbMJr8Udg/E6/6xqtL5lIlWZJ6/NPHT9KBZPKqOZte2Ps2P410iU2GI5n3iSrfvA5iLQ2dBHZhHb18b8t9ppYBHVLYI9K7dkuVzM0v3nr/8Uyzb827oNb2G+0CjP2fWU7gZwdgxRvYCDwssjhNDBDd8F1+Wciw9H98rUyF3qFD07hT3ydfbkxSqAKjShXHVJNregjC3iZDDloD1v7/Co5wDAvtqzb0EmZvFugZvYl4hczQ== 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: p44pkhzxN1SggM40PiTwDBnSD1cuMwULZSJdu85vGB1tORZKC4BLUpyaAKGvvzZ7d2oJjHYp9E5v7EpJlJktbQtSGpVuZCCTcq3nQMf2CZNI+1oHoFHzgPGC9h7BP5OICnLB3JemqVyNyrpH3h6JT8ZNwoQ+3X/s3INPCSUPDNSJMF62t0AYMY1098z1e8K1TOY9+4ZO5e7p6NG9ZullhcyiN658w3cEuQpm3x3ZBI6PlwCUSj4ir5TTQow88LZE3ZeYUMwQDeDESaM4VVwKkP55PheV3IJBNvQ2rpFd+osBO2i3FrrE+pFVW4ALbMae3CHrmMbCjR8gSXPDBkOw+g6R7H6MdskiOZW2+j+SynbJpBahw7UTNVRVkYWj53D+WIc50o7j4BPVyUpCK9rP7r2tpLuSE4SK57QXb+GholfeT19Mv3XABfkYAANxXHVYwNDDI++Bvm4Jmxw37han2Wl1AdUb4OuN6o8i39mX8ZMdSNGydzII1kV50xXnC1bTKwhQEadfWICM6ZrdkRyLyinu+NxQ9UP8105UDKhpdlfhw/tENOKOPu/+UEUrLj2cBDlsgV2U11+rG6lJBmDCNfWemCYaYiUTD0aZEGZcMNTJ5Mk1rxhuP/LKLwOiUDiSP0BJ3qVyQbjRdIgF4KKhinmYOoPOjMzCgz/VOPghPFGr4/6GdIIpmw9Xlw9jEeJt9J0ZMBtDSDJIYTTF93CYhBntxjAYkh32JJxM6gEgruOcSC47a1Fod++11Mx/gyGuxNYS8yVnV3AMsr3msDNoq6h9hRfPTFsg8LJF457SmPchRhXqD2Wf9pdNEZ/1qBvRo7R1ib2nubSRb1B09+TiNIn5bTwV+yleZm9rtVFTSwMb11Y1VjtEeWR3J6UYTVTrKtNXBtDSAR65pyngHhU+Ao3cH23UzYG6KUCPbT/XExP8nzWoOZH+LfvmEumZRvjZdUFS4W4rclv3i+IE4tbqMYh3hObDsD9KM08slppOIHLk3sK1vl2EBxMO5fSWHKwWk8atZSmFBd4e8XbiqznudnnuCjClwZm5L6q7ToCYg7H+o2LeLjljUdw90JB5UkYh8n0MpXeySnditJ7uXQhGQDJP5Mq869ezKw5RL+fWqN7qY5CODuyMlHPXbpdemMMoPv8QLVyle7bYjtVVWpsP+ieJfuiGibjDsQCvwW/CzytOOm6ai5mPn8qw7hdN8MaRsrqOz9ehgaaA3BmjZz3LcMG+rzapMscrli8RPRul7s4ATYPQiy1Syy4KGglkeC3sEoHIlrTpNH8Wn2mfuBYi7j/ruQ4yWRqcFGLDLxiRkSlOrwUKwAnNk3/Ob8xeCpZs21VyNsoYhE3m02nDKpt0I9zi1tO02a8jHcsEzLU2QKhGYArnMHjj1Z/LnCdRl6nbkBMdZvhihpoqfQJ3ecYOlrCAK3YZ05uhcZQilezylAgJB9E4TVgCyxQXIuk13B1asrFcIpjNha00rmFZrvaoPTFbMlhQgCSe2EQjlwmZ059/WrPUXjdpRF3M8gI4s/TYBDbFMPoxF+t5TyaKhw0LaPKVvQLikvzERiYTNLxNGqHb3yrTj12D5pDjixJMIHGpwrtDlEpJRa/xpRrsgnq1Cw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9aYZFL/aLImMLvnYu0TlhU46S/HDXpneVc93wHMqIB6KMFnNnMi+fc3ffReleQXcesfPAd5OjTOnUS+qOP043zFOjlWMc+3imb3hTMQKMzkJ9C7aG4aWPd1F8oqKedDpF8tEqxjbGb48x93983C5vFOyJB0usHiaPvz/aFe05t72G8E1jjtisD9k7qIE5uTT2iITa7h7bDxTT1CIv+T+OBDW5ypObyyw9RNuPMy1xbH3WBn+OVkEra6BkYGLU+8NHNa0ZYjNdE5rqF05K3YGth1C+G4JDNl+8pT9LPzVOCVoAP4YX0NYj2MQkJM9X/1ZHX8OtgxB83w//mkjNunaKPzyamBgifSZseUMpYofl6UApXpXwry46JJSgT8QE24FncVDPKFP+w9nbWCbJxvYhjL4A6bn1uALA0QzWBQJLKdaZe0oSqbc0yO6quTfIhuIQw9SzSffDVDvfN6YyfbL1/Sqaq0sOFoE7QGYnGYxRPqTHPZQJtRc38bRXWLpVkiZZs0DHFl71cd7QSfVBFZdyMVYEkWv/WKhAx4QGsre2XGgrU69X7H7TOblrabfjoWDCot24AOzvT1dXnVADNrnikGyP+xuZXmSfBOjH+YSVSH6a1/VgpX3vkaD2xXMogjg7RJtmaO0P5dECSts2IgrYVuZsjvx+PpOSLydTVRTosgd2teAJAfyZ1LaBerVOwpjz9w4We5OwlJLuVmXrP96nfFYt0cZBMZAhOKuu3RLdPxgVg88RyiDOW5EKawYwETl30wHMurc6sscGcJbh4p2xBwFjy7GisB8Q6dQp4zwrLb0mo3G+Ubsp6NgEyRMPaQdnowkB9KXGVtX8+kh8Wc68+ueQcVnlC44Rk0S0+NEzSH6BgK00IpZaXcZHraCjuAyLnr2JkSPPRJGoZrvm4SoEPyy5036S6wsYKtj0tDoczGUw2EtYLZLzs03ThVt9ivArS1Jpw/F6oV27xdFrjn6LNyzjHl8idIr6KoTKvZ8kC0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d3946b8-6bd2-4c01-0d07-08daedbea677 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:52.0466 (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: NCtTFH7vMUgnmsjRP03YgQ37ycFTm9KUbX4lujzgGnkEz3g2DHgWb26VKQsO1BvLl1KMWtBnasDi6GNf/KmVe+MxsRt8DwYpD9KIDq7SkOU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: 9MEElmUQz69Ond2Ika5OLrbEwv-YixEP X-Proofpoint-ORIG-GUID: 9MEElmUQz69Ond2Ika5OLrbEwv-YixEP X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A5DE2140003 X-Stat-Signature: c9qeu18ajgohxng5tqp3cc4ki5u634ni X-HE-Tag: 1672773266-446169 X-HE-Meta: U2FsdGVkX198qbefMCDfHurtNS6m9usx2a8Eu4xvxex2QPb416M8ZxCHMXNFg4Qz3QJ3fcfAfKAaScoSO9iYDPPLRJlX+JhCA6M0hFr+jCJyoLgwHcq9w52uQYIkuoH1WlH41C1ofxPvMVXTHQxNd/bZ6dEHONJ1W9UKgn607G1Hzk8au4n5DL+lUX9KgOvfC0QoWaUqbziL21lOhW922qrbuoTPOYr0vcHuYV7eZl9P2Bo0YXg5Ke5822RhGBuuKHv30oOeWZfGuBRzxy86mLbDeDJ9hhSUpzILbMlgQ+ZkdjE8O+akht+1A5YfMierTsJ68ONNsmrIfk8j/M6/ya/drKxnw/p8abQ6BuuiY/vLje90hBHJ8FtV/KU5guV+Bf1i55R2bR55DFozyrk4vc/ZmPrEa3Rmb9kt7/sVaApj/Gs7OmFonI38TtgDVyCT5E2e3r8ah05pIeHZAKSL8gxUdPsrfy9Gu98rsCLOXBMXzhy3zDswIb6YaTBiPGTrnjKxvs0RjIRcrJkCYAn3jZn8M79NC4gOnTw04pEMirNHrp5NR7b6ZPYYA1UjkFLn0GhMCE08q9sao4xTsmP9jbW2plM1tpl37p90iKkiQKm74muONo0NWCqKPnTJAb3hOVMCsug0CAwKlZMQIe9+JePyztUlIIBL3judU/oNNrkzvNAajQCgansY4r0q1R/+PK57FB0cygyP3WjNIn7GBK42IeQ+isjlELVOzuZPLtiBLKNbtDpsrmIU/RkI4LUTclkPIvD3ye1zy+hsySA0w8Vnxo4Bc4ShaFS+zXmwL5ddlWRgx+3FUoZB34QJoYj73xjVBZEE8Tl6ZcJr8aWPAp9LONBVc0gGGP1G9mo5V3HkVyJRcLgUpZFfASXv3p0aF4IMjBqaAwoPH4TE7RhKdLHuQ+8pETIzSNUUtNRt5BzO5eLYF5/YHhIJwG2e9V9rqlS9VBJGZBf2zgWeCP1 rBjypp8M cOx2rW6VKF/Vy0t0YSwn3DB3KAGSroSVmTlZzWtv3SWsqFFLv73e4+L4iz4/+QuzldiREu1Dqc1KA1yaQ/ECcBPzjyQx3R1JqD7Nr/6dV9qEyDeAVivWVv9m6cl3WtdU3IPD3saNw9CIrDF5dXL/wx9Xvbw== 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 0b8bab52bc7e..640ca4eaccf2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1209,7 +1209,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) @@ -1253,7 +1253,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, } mpol_cond_put(mpol); - return &folio->page; + return folio; err: return NULL; @@ -2305,7 +2305,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; @@ -2328,7 +2328,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 */ @@ -2877,7 +2877,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; @@ -2941,34 +2940,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)) { @@ -2989,7 +2988,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); } From patchwork Tue Jan 3 19:13:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087998 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 1FA57C3DA7D for ; Tue, 3 Jan 2023 19:39:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 95BD38E0003; Tue, 3 Jan 2023 14:39:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 90B5B8E0001; Tue, 3 Jan 2023 14:39:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 785388E0003; Tue, 3 Jan 2023 14:39:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 688CF8E0001 for ; Tue, 3 Jan 2023 14:39:43 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2966DA047F for ; Tue, 3 Jan 2023 19:39:43 +0000 (UTC) X-FDA: 80314502646.12.33268C4 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf09.hostedemail.com (Postfix) with ESMTP id 0ABDE14000B for ; Tue, 3 Jan 2023 19:39:38 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=sQbix2s5; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cu8CCfW4; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.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=1672774779; a=rsa-sha256; cv=pass; b=7UTWy/vG8F1oQk6jBXUCWiA7Op7cCF/NJDvB8BCC4MniCNNcNXkcAERg5vD1Lzd1X9fv3i At+JewDXQUCb5Jx3N7W5SCb9jepRnLak03sKl08WYciA+atBXDefmkRFpJuxTB2GMUai6F gpl+nOW1vhkeJpXKXUS1xy17pR//90s= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=sQbix2s5; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cu8CCfW4; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; 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=1672774779; 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=Got+/JhlEbn00M0JyDO+i+N0rLTksWw+LVmAVXZxyq0=; b=2WxbouJkwcn5Ys2U0rnEBPPm3nV7BK/tbERarcrde8ELa1S+2WrZs6Qs53lxSNt/49+bRl 0za16TEUDFwyaac5iu17lW9ROni943YObC7ZhYqQ+G0KyzEoZLy4vtVNaSN3WLjAsQvM7T QeNwUSEN7IyA7+vVexeGPEQdU9uzUCU= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303G3gkY002803; Tue, 3 Jan 2023 19:13:57 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=Got+/JhlEbn00M0JyDO+i+N0rLTksWw+LVmAVXZxyq0=; b=sQbix2s5B2oXoDrDKOqFM30ToN68i7RjI/TvYtVbZUEvXPACUkUuk1qptiKh1l4kv2ff Hoo/x89KXX7SLun1I6PfotxLOXGpp+MU65sfqF8KAldNnzA9HmRcNMcBjVppncqfThd2 RdewSUnS5YBc5dzC4Vv4niJ12+c1tudw1JeWtN3NgAyQL1vVYhrXZCMbjhDUMZsUuU6I GXtcL7AglsBr6HtfQD99rDwoV356OB36yB0tUlYWeO7f97FwUsS0uwAcaLwCYugm/9wh TfoVPwpNJcQKiYAfFGfRTbzCHU9MMohLtfLESknjyIhvUapfqVaGLxG/ifq6PJqCPTKN zw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtcpt4w39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:57 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303ISTnK012266; Tue, 3 Jan 2023 19:13:56 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2170.outbound.protection.outlook.com [104.47.73.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58q1f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=McgaTY1uzXWVRuOjCXiC29mVE4X8gKceCPBETOtC5gotSKSCKZ1NhVnN9DAbu0PaJrtJVJSDhSVKbGZRAlTUCbB4vPhpNSH61oMZcxjmutXnyGS1363ckfQnF28k0ANqLdt1+EHGI1ylfoiDTMT0gLKw6h85cKsHbcLRWa8CI3nWZnnilSS+BXa7QWCBgMErmJtKL/WLQ6UG5t/qs6hiMeaqFPIUCNtGVqmEOrSeZFLo/Fp8j0falAdFQdf7QGZY1Gj2MxsTxUhfXF5OSC/TtgrD5UWTq+KqNeJ0VkESyh/7xBK2gYZLQallQmUAr+ZPldpDOSYn4sMWy3mELi+OLw== 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=Got+/JhlEbn00M0JyDO+i+N0rLTksWw+LVmAVXZxyq0=; b=fK68sB+ErNdoFI3gW795pCcVVanj0efk3f4Glchc2Yi+qBbpbeWuG5qgNrbyEsDaRYvYSuXkwImn0WW15ogXX/UHTvUc4Syuf3tYV7yxVMQ45IGPlJi635nor0OJu0uwFg8MmUInOAQ8B+o/hlMGPFy1mwJdSU3N0k6iXbKAsuyR2v1yH9T/oTlL7hzYgr+VdcqjHG9yMFHqA+kfXnn227uLIJ/dTvw/WN99W42k2dfwqnw/WJ5GIq4Rztl8HkzQ2QXoyi2wxDEDQDEtQhlMLy+FVklapOnk380yW0XqJrUgT3Wi6QWOSEdvLR+qW/1U6d8almRBxQKG2+IuKVjA5w== 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=Got+/JhlEbn00M0JyDO+i+N0rLTksWw+LVmAVXZxyq0=; b=Cu8CCfW4l44t8iV9Fh75a3AQ1XjMETZQU27unL1lBoDqEGnO0y61ymKe6LmE84bANyyOG1XpmQ70l0mBjJXdhSVF01q6q5lYUSPEhoJazNn8B47tKFwxaZlai65mVMEcQQrf0hdTiS2yyFQtvh+7EhXVGGtPWlBRorpP5+WwYgk= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:54 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13: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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 6/8] mm/hugetlb: convert alloc_migrate_huge_page to folios Date: Tue, 3 Jan 2023 13:13:38 -0600 Message-Id: <20230103191340.116536-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR20CA0014.namprd20.prod.outlook.com (2603:10b6:610:58::24) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d897179-a488-4ade-0f99-08daedbea7df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9FGS2JXdQ6uqI1yyOV6RWxxposKF3Jj5vNCCv1euCYb3SRQ0GEEd83fpQqK2UKiWaS85lfvh6N0cRiFKZPXMmps80jg1sqH6LeFddhYG7j0WPJ67xKEEdi/OUM+OBBnof9ST3sYIz7kwRjVa98qmH2HYvWvkiD/C340xbrjFCHMq3FoDkoF6h8p4dfmR7H+UiZEtwgZM4kljfDgay+XefmxEwgArTdMP/P76NvdAqJFe2IBXxL0hmZWY60d16SGo+dTbksi2fKh76sFkatRW1byjPf9CaN7OZFBMu5vsQLxQ2uFLzMjdve7pMjW1anw1/iDoPdgtq1kUugTq+GfF8L2hyyFeZsipX9EBKguBamAVjbpUGyDtmy2WQflMrjI8jbi31s7lnI+szchZokZYGRge4P7Hp65gs2845MkCJKQOHKajW5mhIYZVHsycaj3BlfxiLi7Cuen8NpqPI9t/sInI956i6H0u/v7wvmsEt5MnFhGWPclVifSHfgkh3RlxDWjGC438GE6msyIwoxLeZm5Xj3Q3X7t5nK6h+9JmSTnFnyBBT2cO/EvmSpdMdCZGQMHeE28fJcht3Icdbd+txZCsQ9+1T2Bapd0ACG/flLI90vvXWGeioOiBMswW6YkNxhEqm3mMHADngQSqsJeCPjvC3x1MWFitYuesXm/FfDdI7O3Hi0kk6KnTLh6txZXh3JnV01+B55gXq9mYCqTH7A== 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CeHWXLplE0WHpEukUVK5iKKbQdaLk4kUnPNYDEp41IsItpiRAFuw+DbK/Bkgo+MUYZcswYPPbFHQsr46gMZzwYHBm2p1RSJtS+PkroU9ZmX31+v6Vy0+i5bSdFHyMABd/aGm3Y/OnOaN2Nc/iYTkYySgKvQW5HJYILeKfYclDWZ8j2i3qR4iGa2O+JNMLEA8OEO/7ZYF+kz0v0NtRXvSkLH6sfeKjlrKv1oHEqQfNElsdX2YLvUoppLdx3VpbchR8egGpA5TzdjCtKhUsDEldOZjuI7DTUqPSHLoVGcW24Urxx5Qxl2+AaiEl0AAAXm0QIiqC8J+xcZgwmRaSGHobTMqelX6aqbbw5NpvJAz+MfQ5XctODdAqiMaDU9WaDAzX6HEd43gH2k7BOrwVDrZJJIGCxoOgYBLvEBtysolmJkzwhI7dTnFAaS3e1tb2T80V4AYyMdLfbBPeIjQddoU1wIbJLczCI+VG/zQ5FuJP7uQma2ir3h92dbRIWEbA4hDPHcY7XBdZtukso8Tt1gUG6AKXMqyTKxsOnrEMLBQh/MwIaFlA4PI2n3gNo4RBI0fynY0ma12wDBiz67rn0QskIjmfgE+Z1B7P/ZReVp+TzGr6lmHIWz/gq+b57fNQDMiEzwvbm/vVMrsOKIg0M5Lw2cvIMUUxo9rXoqnRnEG9J5JoFur0arAiHx8StfEn/JYzRbI744FcTGj9yI8XLp25xkypwResbAqDN64t08vX+Y7GMxXM46DjvFfCz+hdkKfu8XyXN9htitzC5r/2r0IPsvY0GmMzR6EGAv9GWNElvmnI0itrnzncMYPU+DHUrLiVX0Qj37h7MWhIVrsNeJ/y5Jz7UlAE9poC7HpbBBYYYo2IlTWk5eeEv+ATI0GOZoV5TiTxgGXDngkuCRbJHO527PoBMYHhMWBbBO1oDvBkK1E8U9No0SV0O3zV+H3lSVExi2LKEFmI5xKGHAGJh+a/eyLxWoQ4zRKvmvayQfhaIs6BF+63Z7rH2J1BcRaGDScw9ZEEpNbXl+dvx9BaCeBUR/1a3FjmnLT7KsGpCM7lZxiz62dp0z89v6/TRHhAftXO5qRcAGdBLHulMdrny/jX44E1z6fPRWQJch0SuxsDEH62MAtSeIWTc4nq/a6WgLkNtrRKe9W5M29zk7RTIgnAFpmbd0fXMpXPDLm09YCejgyMF0jk1JldTUwYGy8EG5uaDhylfS3n546u+ObbTTxduXTK2/JFiqJjzsXWZ/ePxS/earFVtBHsexdutbszolci7KljKVgGrmlqrndm6hE3IxCtugKfMS1GsCOpVruYjNGmjTLCsVsvolJFUYvpfE+0kI+O2NRpXq+iL6cuybrJkNmA46eAKOl2gorfzlohlsH5hKKTYAAhqhooeg3NBl83bUDy3mxHhTARmQT+axpe5r1nbXWrcLLII+l6fm8QJn3r+suHpn7qZTTmZ6Eh6UznoEbBBTU8cOrYSSb5IQwP0v8vh1pLEfc+GYUFaZya0glOUKso052glr2vtEitoHaMxmwRXD9qEbd6jWl9jFAguznPXaAltU04bQRP7LLX+YpYoQBo5fnEAhf4UasYKs52YYoZ+N7ZuyEP5oRtrRLeQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /xRf5i9sK1xaGS/w4kEBJjWn6RM1RLqIsiKYgqy0y6Qsz23HbA7A7WjftdLM7rREC7fNjldG8pVtzC3TigGkkRxgAO7MwBT6zOyPoaEk5z1AW/RgIYJoPDZWI9ei777/rHUJBx0YqDXVR+FFA4gUsWZRiJUgq7ZStaGyxp3srvgUUihwe25tFnVv0GIzyLCqcGdvfmttX4ifEkIUMrDj6mr5f2amsZlFxgp6Kz6SK/xwIT5PMjj9nm9w/NB8dnizjjH5wGQ8fs6qq5zpCdn4sgb8fnGbctu/2ApXYjmI18zZ2E3O7CQdW5DL1Pgv25GrMF53rME4Jn7LWFntsF9vo0dFxUsUQkm8dfDvJjJC3XE/CAaxHzk2B5GG88anCU9dI2t4fW7ksW535o4aWwr/COyhWKkW+s5A8dOoMeEVu4X+NTr3myTZmUM77TZa1KqFo/1rmVR498sKOq+hrdoo3tzLzYnUzAhbKKz+UdvCSA3OgAffP4BJJQN/lkcaVTOBYaUP5rWXwAtgH1xXp8hBiOF+DxnWP8uarg0W4VcJDgvTRax5yiUIhpOHWMErHMoUMjpcL1Is20WWRjXrDddkhzR9ZMgFWxb0eNlXhaKFdWAgsFeLx0rqq0MgoBiZgQ9wZqmPt/u8I6W8xkZ5JX11S9mqx5ggFgGs8WId0fcapIIV3JdVckKZpoYABxq4ys1fjE2PpAGxdTtglzCz6KKm6cu2Z7jhf8M3oobqr+cU1H6Z1MiV6IKGNc+r/Gmhyd5qVz4N7wD1o0PtjgPKMPm4KF5zpyFllRhrqOfnez2x/ihC2/Y5qoCzSU2Xccq06EXzomkxuMufa0ygDv8gvJn/RWRETNbCSOqUxrpmCC/svKgo2qTY2bLiC8HFHRb2qr+mDF3ODtIcTIs8m0GLIq+sTwOtAyXjNEgMDWnWYk6Lt+J4gyIad5UnRLmNbO7curjtfq5DKFuKe/jtl5/bx1QaQa6ewzeySM1lgx6rzC+2Z6I= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d897179-a488-4ade-0f99-08daedbea7df X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:54.3891 (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: xVxvdyv46VSJHrQ+8Dk0Vf/J+wgBwN7kKFbFieuvMEsU1ZcirYXvH6DoDa5N7xEreINOzaNbXrZ6WLGeV0OzXOsKlZ6N41FuiRcn9k7leMU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-ORIG-GUID: q05cFM0JuZvSUymM15PuDO91ftZAePl0 X-Proofpoint-GUID: q05cFM0JuZvSUymM15PuDO91ftZAePl0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0ABDE14000B X-Stat-Signature: guzsg5dciusgwa3qz3irj876iiaee1mb X-HE-Tag: 1672774778-131214 X-HE-Meta: U2FsdGVkX1/dP777c9Wvz+2Nd35XasiYB/I9KTc3j5LulIsl05PEhJr2r7T5tHrPwnE/JDOt1rRAdm254le72NvNEkD0+g58e7faoqZSnL+He4Uo7S1LGuTl9KpwUe1bUKxU8Q08Rj/0uXny2HyKKOUoNhaHBo4aH/IRBkcBnzPkAzVVt19GgUOAvHC/udADwA5pJQOVjxQu9FiZtQ5vZ8AVp0W8g0/CaDwDwFMMkP/YesQlhBOWMNbtSq8kHHwwUDftCOn7l7MhoacxzwcLoOdr2zAuZ/URZI57+3FSX0lzLH+JJw1cgrGp2V7h7mg7S4PtXcBSiEwNskDpgfa7XAHjACLpHhRzyKwOgTWf792yq2h4JGV6JEOz06b5BA9abXQEdxgo1IqEx/JaHrkvSXYrsRxM3Mkj8ot1khMI7Dq4RpyiFxGv6TdQrABUHOFnofEK6S7wHM0c1Uk2HCyehYgcpsO5yAMvApZHQH2aPbStQXwVCTlhyujdPG5IMMDg+jcysjeVUtp9z967a0iOpIdmdZdc+ZA47nww92yNVHjWuypdFu8TrnE1kBMoSJN7Nkf+MJRw5UE1vRpxYwq140isqlnHmMx2LsL5KPXrpqzG9qtLM3nn/LVH4Tzo53+qZaFr7F4E8i/4VusIKoVkxiP1KSocpZOQ+CrZ8Sz4VilFzpdYLkL6dgYLqRWpHwbdENjC+35J81UvJA3vXnj4KXs8hnuQwgIT0oWhIb3xDGR/lb+UhhQsDYS86W06vi+369qafgpP6I9s/zaXRj8m2pi4t0BMboZujMeJ9novUru5kKB9JenKwubkPhM1qyiOMX/3MvNXg9pIcUUtMQhPCb9OrUz3o3psDHebPgVX5sodDLsF2p5P4q27eMYY179hcq9HzIFqb43O2DHXGXvMOHfKW5VtTA//tBcu+zoS9KpP4XX2S4c77RkDjY4eLMsTVYjhX1apFHZ2e+17pke p7JfdLTa 3dW+GhFgoT8j9VgJptNmnR+k8p/TLkyaRNh/fNrHcEAjoVrRWqCvNY4iaQWOUdi45Bnvop6kAD2idGWRIlQD+Pt9KqsugxCqNey6enaqqODahtPnX1gF5KFRW9dVIM2ysnXEddyP1PotGscTLb1huTE7j6A== 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 alloc_huge_page_nodemask() to alloc_hugetlb_folio_nodemask() and alloc_migrate_huge_page() to alloc_migrate_hugetlb_folio(). Both functions now return a folio rather than a page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 6 +++--- mm/hugetlb.c | 18 +++++++++--------- mm/migrate.c | 5 ++++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 482929b2d044..a853c13d8308 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -680,7 +680,7 @@ struct huge_bootmem_page { int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list); struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve); -struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, +struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); @@ -1001,8 +1001,8 @@ static inline struct page *alloc_huge_page(struct vm_area_struct *vma, return NULL; } -static inline struct page * -alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, +static inline struct folio * +alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask) { return NULL; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 640ca4eaccf2..0db01718d1c3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2278,7 +2278,7 @@ static struct folio *alloc_surplus_hugetlb_folio(struct hstate *h, return folio; } -static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, +static struct folio *alloc_migrate_hugetlb_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask) { struct folio *folio; @@ -2298,7 +2298,7 @@ static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, */ folio_set_hugetlb_temporary(folio); - return &folio->page; + return folio; } /* @@ -2331,8 +2331,8 @@ struct folio *alloc_buddy_hugetlb_folio_with_mpol(struct hstate *h, return folio; } -/* page migration callback function */ -struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, +/* folio migration callback function */ +struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask) { spin_lock_irq(&hugetlb_lock); @@ -2343,12 +2343,12 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, preferred_nid, nmask); if (folio) { spin_unlock_irq(&hugetlb_lock); - return &folio->page; + return folio; } } spin_unlock_irq(&hugetlb_lock); - return alloc_migrate_huge_page(h, gfp_mask, preferred_nid, nmask); + return alloc_migrate_hugetlb_folio(h, gfp_mask, preferred_nid, nmask); } /* mempolicy aware migration callback */ @@ -2357,16 +2357,16 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, { struct mempolicy *mpol; nodemask_t *nodemask; - struct page *page; + struct folio *folio; gfp_t gfp_mask; int node; gfp_mask = htlb_alloc_mask(h); node = huge_node(vma, address, gfp_mask, &mpol, &nodemask); - page = alloc_huge_page_nodemask(h, node, nodemask, gfp_mask); + folio = alloc_hugetlb_folio_nodemask(h, node, nodemask, gfp_mask); mpol_cond_put(mpol); - return page; + return &folio->page; } /* diff --git a/mm/migrate.c b/mm/migrate.c index 6932b3d5a9dd..fab706b78be1 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1622,6 +1622,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) struct migration_target_control *mtc; gfp_t gfp_mask; unsigned int order = 0; + struct folio *hugetlb_folio = NULL; struct folio *new_folio = NULL; int nid; int zidx; @@ -1636,7 +1637,9 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) struct hstate *h = folio_hstate(folio); gfp_mask = htlb_modify_alloc_mask(h, gfp_mask); - return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask); + hugetlb_folio = alloc_hugetlb_folio_nodemask(h, nid, + mtc->nmask, gfp_mask); + return &hugetlb_folio->page; } if (folio_test_large(folio)) { From patchwork Tue Jan 3 19:13:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087915 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 D0283C3DA7D for ; Tue, 3 Jan 2023 19:14:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52C4E8E0007; Tue, 3 Jan 2023 14:14:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B56A8E0005; Tue, 3 Jan 2023 14:14:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32CE68E0007; Tue, 3 Jan 2023 14:14:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 174AA8E0005 for ; Tue, 3 Jan 2023 14:14:29 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E6366160B10 for ; Tue, 3 Jan 2023 19:14:28 +0000 (UTC) X-FDA: 80314439016.22.719EC86 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf27.hostedemail.com (Postfix) with ESMTP id C0EBB4000C for ; Tue, 3 Jan 2023 19:14:25 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=0o5GNMlZ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="KjSc4/JU"; spf=pass (imf27.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=1672773265; 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=o1pwg8coY/UF8sIXZqLBGXJKgxdhtYJT0zB5UJI+K/Q=; b=eE3OIttVnTSQ43yZ7zNz+d33DOyK0oFVW0q2lIbflECfgO590Z9xfSONkwgPtpJ5L/gtlp NX+5lsSQJVc/+FityPeChAwzvsMCpm6RgkKdPLx8wjnLgCzg4xrBs3D10swDMBInSqcZxI k+tgsvFDtRI55Phhm56R+WwHvrVJGBg= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=0o5GNMlZ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="KjSc4/JU"; spf=pass (imf27.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=1672773265; a=rsa-sha256; cv=pass; b=QvgMx350dtbnpRqyDzzEmLvRDTnb5/u1+PiCF2/BM5NG3cA252cksiyrPqHXrmnCabT1rN kuc48W/TzK3zq3djAhD4CB8j5hnTTSXndB9FcJIxXxQSrTJ+ZsUtH4tx6uqGYYItoBsPv+ gq8TkkKT811vPhvCywkuCP3Fr01yWN4= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303JDr4F000990; Tue, 3 Jan 2023 19:13: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=o1pwg8coY/UF8sIXZqLBGXJKgxdhtYJT0zB5UJI+K/Q=; b=0o5GNMlZzKEgBYeriJDA1DcdeOL28k9HpXNoUBfQLsLGu5zsgFW4uiA8NRGdLm/4SMWS JlQD0jYUOnO26AeSX77Op4XdsJjB1qmA7UZxBX4QHWTqKQFvqX57Jm6ZWwbNNGRIiaSB xMokgIX82rUuCGwIT7I56lVhhsEejaTgC70zznw8Gq4yoi66PbSQHLykzOIT9UYGifz3 8pILBbwQIrf+/4q1+IUx/hQQmfhHrjqsVW6hSKl0ii+aO+iSd1Ly+zAx6pj6LmLoq8k+ OEkmcWGzv7UCm7KawktzltVSt21z6JmgjhfPc63YT0TW+b905MVebbX6PFHtF9S2iKJW Fg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtbgqmxj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:59 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IMXZM012211; Tue, 3 Jan 2023 19:13:58 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2168.outbound.protection.outlook.com [104.47.73.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbh58q2m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:13:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eO5il3iXV/XP2PVS4Eq6Y0o67XRjQY9XgK/1TPLpTW/uJF14YJF9PTKBHaGGvNW+TmJXemO+RovblFYhUim4uB6iBRN5Om+AzZiJDMXSAAAdjSM4cT6bFMwWt+opV5TYrZrVM0laH5CEj9tzWMG5pirpbTwUApu03imtxiY6Vg4RF8IjgmuM3f+uCrB73dxib39L9CTmUVFQZbpV3pHVdGFhC/XIkpeCZ3Nprvq2yUkJKjlIPTyE9RzOAp3Q7LTcw1upKRCxaC/WCucXeQrGxIhNtrzLYzZ07BNe0wdc7tyfHOs7BD+B5Wf5QfzACNune4qoTKAZazf6Y1V0uSF2iw== 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=o1pwg8coY/UF8sIXZqLBGXJKgxdhtYJT0zB5UJI+K/Q=; b=mW5ti+sMatxEBDVlgZRrhtFxhOImedqzpeZmoXbjSUYCzOnJH+7yLqNZk589N5kNRflNwmi1JTqEodkV1FW0sc2v43uvA8xzj0g/UySf4OEIWwFTCtmdRNfBplnmhjNDngUPr/BOJFPx1o/poodVu+IlgsxtoqjnsbzGtn3VCtxxrBGCV52cy6UPe0nYEbP1aSkoxso3xczWZaPNWEwWZ+90JRVdf+32Pbky0jdwoh2Xs4BRhjOt/BFXbFqF+mvWDxz2Stfe/pqJR2oFYiybJMUutb7Q+628BnA3IkeqHTizf8KQX5KgjuF3GpDGHSZp87kt1XHsu9LfM/PyIOzwzw== 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=o1pwg8coY/UF8sIXZqLBGXJKgxdhtYJT0zB5UJI+K/Q=; b=KjSc4/JUXFqTifWrfaeOJmQcfX5cWP+ktHBfi9iA+3U5B8gtcPx1zSZfK2U2nhbpa4SUVMvdBcKc2UcZEqfAb4YX2SLlV8WE1e+CZOZKc+tNCbwrU2Ov6Og9/zniSFH2BVynyjbaAZaE+oET5Tl0Ec1GlVTiN9rPqAe18aw20SE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CH3PR10MB7332.namprd10.prod.outlook.com (2603:10b6:610:130::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:56 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:56 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 7/8] mm/hugetlb: convert restore_reserve_on_error() to folios Date: Tue, 3 Jan 2023 13:13:39 -0600 Message-Id: <20230103191340.116536-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0184.namprd03.prod.outlook.com (2603:10b6:610:e4::9) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CH3PR10MB7332:EE_ X-MS-Office365-Filtering-Correlation-Id: c04c46dc-f5c0-4a27-89f0-08daedbea8e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lPKYMrosbJhbm0WQzoqIjR3sgAch7u4douUEXWly5ckXeefg36S93RY/OeqXCJc5noQW8mtZJhlV6/mJAyou9FoUWC+L1VeyVJ181mzAHA63cYhLQmxRAl65zg5v8xjKEPUH+ijnsy07pmbjvAtXzaxmPVO9ERlaBBIB9uMK8WTJFomhez8Uw6iQdx54gDM/CvltGd5eeNTtUFH2VNOxxgB6+l6XZ0IXq7ebC5x0Dd3l2X/GPw2CUjsCYJfHRj9g97yFzBXCstMXXgkZbK8wnxJN9fWOpYlB2tt9WoK6LPY97vp7xgv657elZQX+JRDAAvEH6IJvOyuYKC3qLZSj9o4OnCBapnCNVTPLvuVX/Jt6sSMmEvv3oUFCqXUb6NvnZnWiDAvFb6dyVQPqpEmx2haKDMHhbboVojrgSGRivle/ux1sCDBr/Q/OW+nJGhfC3jOa+9taBnv9qQUaJ9qC2o2axOwqelIbdCZQ2gLLFneDHOgYIBGMLE4kS5b+msylfH+XKB8ab9pfeiYPp838+IH225gNRdfz7HWf0wQvBvw3lL4EggLJPY6nOC2jTQaChZ0u1KnS3ifA280hlCbjWiukdKHKLs2d8m7G28KMDD/RE0eboPubT6rRwF/q5/zSxuBe8LgnFKIRY9pgUcOuFVeogU3ahllKlNm3sB5IyLXmoBsfVLcuHotZPDQtQZZg 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)(366004)(136003)(346002)(396003)(39860400002)(451199015)(5660300002)(2906002)(44832011)(8936002)(8676002)(4326008)(41300700001)(478600001)(316002)(66476007)(66946007)(66556008)(6486002)(107886003)(26005)(6512007)(6506007)(6666004)(83380400001)(1076003)(186003)(38100700002)(2616005)(86362001)(36756003)(22166006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZUPlx64IEtVDVsqNuOPKbwb5mcN8/cM5mMzYfId0YKrTvUOgtP4gRcasizc/7DcvbAeGskw82UDrBFJ9iIrpgVf34dgzkpEy1T5SygW6GrKeTDEdtvksU9836HDOYL/5POoUd2ZSCrnDmg85ogleyGzkBYzzN0z9YM1uuPJ4GZL4WFqyWcrVc/nG0QDovy32u+HE8a5SGikngd6iLh7fNky3CLYhvb6GGwRrZgwb+ctUJ+6sx39A8Xpss/+NFXsbKdQ1vPubKBdz8anpznnJjXuQ6QYeEEInLZTjL/jn9oAjh8wPGD7qtmjIIkia6MuwWpsbREDOjyYDdyKuN5gekY6/i9rwGldAjTct0MLxADXPuX1JPFKbkw3Nmod42OLKUp/dHPrcoYwBY6aIlImRq5Mbi+dAgmesq+STpyg2CH1I43KCWSIoKSVoKhwh3BqFNxZ+HOiyaD7FohusR8aLTTr5RrpRVk2dRAsa8+i0L2nuVTnE+TOdxK717yA1OLvTnGrf1bbPqK3rlLfGYv0hglaALn2X/bFrZeTRmYiUnCzWLpw9tg1In47tjxWvuNEMEVS9h6iYQ1ou/ngbwdVFlCTnPvCQQj2NKP8vgg49dL/KqFsZajgvUreVfF9hqU3fAVF4S2MNDRKtaDZtzYmd/ApArYCsnlPEXR6MAipeL6J+DSgGVu/gyRbzd1uA4rJjGxrfyPYPlay+BWBsdo2/vg2HV6LN6XtholD7hLKPZlxsDwfwfI0kRdp7viBOIbeDToNpR6bcCRr4ez73tllf8/oGRPCUa6NDHLK0rM4u282nBjgEvHczUdCakRZ1JpDtIPcDmI3citpsMFeuU5/djftg0YLyQmC+uUwgAIRPP3iJX1QE8UhdI5iZXwiNg+JJdSjYQaDrTvH21wt7X8LRtLSqIUR+ZndF/497WJ/jz385HYtVh1uWw+lX36mp3bKYdp5kcFrvX05w2xnKtk4j7ZX7NK5FvNoT4SE1abmfkGs/mE4I+cx1r2VysOADB8ZsAJ3uRrqpuSwkkvv+EfzqTD0O5oQy3Bfr0N25bNeBhULRff6CtX68LFkDjCqGTZh6+xadOM/a2OpY91+27kvNdzP/pAZrrZrIZlw+sI24DuWiB9Z1MgFK4hT5wXBcm7pE6ts4yWw2FnpAbIdNi/ksEEHqZXEU+JqLW1FvrDeu9NabzvP7d1IW5bEXlH+dFHmou2E8gIn7VY7Ve0Un4Gv9yNjUopz8+5ualVZHnwmG7wEUU6LD8Q+UsZ7SqLZd8VTGJt86TtIyyLYWfCk0tUYgUYurYGh5HYVkU9Xv+yBfcnYHaQOF2/mjLdddi9HOdqc+nKBZLlJYcXWiOCV7uPJ3BEK7ScoG6//+lqunvXYfU9SZvYhHLW/Dmi5xqSdBvNoeCQQmXhjngUlLmelwgJRtXV5QUKGyq80z6C5UA9H+NgdkT1G1qZ9sh49hwnd7Ct/nZhf4gyTonW7ppBfkOYg/vipqxnBbRQ2p5fK3rLSqaCq3uOjF+E0QsPyi6uzUQLi/ZpVuHSyt9n0ieIl4ynGndVlWnVbQPIR5ZAJ1slwkkWoZBzP0vBK470xxMBb0EzaUd7UxzQxpH+EeFdAdJzVp1g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: vfqmpohOdM8fXvxLpu/01ZuGzOg7PwZ0ozR2lbajVzx6vzhLZiiuszQyjrclryl+1DpQKjtdmAGANtlhKMvPaXe5/B8CtxvPLsj4NuEdZHfulYsm1omOTWxD/JMudIUY5+Y+Irp7aSUUtEg/Kk6e04+DThJwz3eQRmbhCH+rzZmmoZrE3VoCZ8phTjDxnTgOYsTZIuLmHeymr8Uyhd66qXXu44UjG07qwQVkf4/i/oNbARA5QAR9JdJ/KaUK14JrYsMPCvzkq6OEt9gVwODkFdFOnhbxwgiLTFVE5TOv+VOFrWxG4XPSlJFWAzmRuQeUv53JunyUp5AG7GkBYeVWr7qLRIttWamhX3k8KGNt+sAd7+krzmps0lNzz0z9CioMZCwA/5BetYt1P+pPPZpQ6jbKRx7KbZyfWMYrHYdXvy9UiXduwqYd9pX6e9STcxHSW3OOljPBGmJ+xzTiclckR+TF8xrjShvZseh56nQ4gZ1xCrrf1zG9gWwiUJhFocevt1Ts0FPU2tBn3j2qHTeFAzcXewcenz0l3ZTmbRbM6ulJ/Ay4SooFbiJtogV2cfSyLWKAdZzSpAzb/Wv6lRQ/hz3OHPbEAuh8d8UW7jZOxcNFt9drnGENFvuOYP22lmzpKe9qJuBqR+K3Tbm4wHOHR1wm66NuwZOx0FZEZYmstn3LQXc6f9UL+j3khuT1jrlAQYL68AOfmdTK2LF4jkYsxnEHAkptTkT7x60AvnHDpKQUWAvsmQ++4opGi/TbKfqLAWdBzkliz6Hm+SbUAPJA0MyMOQwS6MbJpIHwS9qh32l/Kn+DVRSK1SbbwfoGveq2FdDEp1mM9NwxWf2tyi/4wVO99msqd5ZLHkPf80QPPvo3U99KOGE6T1uliCuPL5NGd5mc/Co+MIxLnbfhTCLu9slXzwGk1BncD3kONS6EV7jtg4nh21DkU9xNl6KatiO9RIHX+4Ka496jbAogE/ecEhKpoMpFs+CL/RtXYEhUPK0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c04c46dc-f5c0-4a27-89f0-08daedbea8e7 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:56.1550 (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: +JRmlWVWl81M5IEhYBPgVljDqVM0hG+VWqBajXFGXKYugvStYZLQ1th5ndstJd+SggTblra6fFybQfZ1L9X10CXkwReZcNGol+saRckMJa8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7332 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: 5bTscqf6diMvsntDreXqtd4LaLPGaKlJ X-Proofpoint-ORIG-GUID: 5bTscqf6diMvsntDreXqtd4LaLPGaKlJ X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C0EBB4000C X-Stat-Signature: yoyzbboq17hbajqxmeb1zbyf5za5znoh X-HE-Tag: 1672773265-258352 X-HE-Meta: U2FsdGVkX1/oSExiL0olCQtHDhRB3AbBtEsfxNbaceU+3i8VV2UqR0fSy1IKfUbc7FNrfRgREvWAHqb78XMj2loxRWwiJbin3pj4XfuCfcpAW10rGk4vWP22yLUuZzO8SzHp2vUSV/FQILc020TJwYQg6VGpiwxGu/7hG1NjbXPJt2tkD5BvaVn3X6vy4z2Q9kcCvAZ+10loyOvyKRA/0gQkKFk5xQ8NRrMJfIVBiITPR/eLssTDdRpKqJo9/OYuctFEdo+UqmlCdzDd0WCkS6Rfr3ruLbs3Q17aV5iFLB9d0etHuakETncHCs4ud2WGel63TMWJGKMFeuDAyZ6DEqfseGq3mjpry8aSZXsS9dzTfk6Q93FxY23vinBnnfWna2rpSeOSzFUNPtgazTIq/SgVuMh3IBg+x9ihiVHGN22W2dgG6PzNeei0yqJnMWTRMPuf7Hcd5XdlMi+fTjNzAfj69n6gzGIgXX1WLQni0s2hz9L9L7ASHRHy4SjKGGJkq+mhDGHgSwathJAyOnwRR3vbAEULpbPbemEm4xDZI5K/ILZn+aSLQFqXewJ6mt9ZfyTGZxN73Z7Qe/Nl2uG6usLZjJmryZ0dh/3cacuhC1UlxTVtgUpUwVA0wWzZFHHmxl2R24bvZ9ICfie445EtBQeGKtPOQmOo0UsbR1QUehFMzH827nMZEB9m6Jf1OfjkokLdhuuKXP1nOvgFhrsVO51i8mNNsA/URUtih5qeEI2BXt38C1sgXwyBnfDpvA8IOszaV7HFwY8IKuFStjqUlb3HBMfmf1hsC2WJBivvMJlIQGhs0REkCa7DeqM22KvDHlHWUEAnaODmj8cZNHHMDNYdRiauYqtL/T2/7k1R+ZhFIZUJwp7XVS1KXdeMXx0K4jWQ76xKrQiwWb64+Sbo/+hUvdQNz201nK1RSRsz2y88M+5J6tQntHOlpUqHk1jQ6wpb9lqO3VB3qERU1BY azSlP0TI S3YMCqD1pZ/mFPUg1lPHzDiRRhqH+exDqDhlzcneFy5GMb8oPg+3BHmwFWWYDYBGS9/6qQcZSVzr4m4VEZ/ArKpqIG5wE8QvAYFZJjsjPTYcA6Dm2hujsyQwYkFu5IJ2vDY4J4ys67OxWquiIy3L3auJVLg== 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: Use the hugetlb folio flag macros inside restore_reserve_on_error() and update the comments to reflect the use of folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0db01718d1c3..2bb69b098117 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2678,22 +2678,23 @@ static long vma_del_reservation(struct hstate *h, void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct page *page) { + struct folio *folio = page_folio(page); long rc = vma_needs_reservation(h, vma, address); - if (HPageRestoreReserve(page)) { + if (folio_test_hugetlb_restore_reserve(folio)) { if (unlikely(rc < 0)) /* * Rare out of memory condition in reserve map - * manipulation. Clear HPageRestoreReserve so that - * global reserve count will not be incremented + * manipulation. Clear hugetlb_restore_reserve so + * that global reserve count will not be incremented * by free_huge_page. This will make it appear - * as though the reservation for this page was + * as though the reservation for this folio was * consumed. This may prevent the task from - * faulting in the page at a later time. This + * faulting in the folio at a later time. This * is better than inconsistent global huge page * accounting of reserve counts. */ - ClearHPageRestoreReserve(page); + folio_clear_hugetlb_restore_reserve(folio); else if (rc) (void)vma_add_reservation(h, vma, address); else @@ -2704,7 +2705,7 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, * This indicates there is an entry in the reserve map * not added by alloc_huge_page. We know it was added * before the alloc_huge_page call, otherwise - * HPageRestoreReserve would be set on the page. + * hugetlb_restore_reserve would be set on the folio. * Remove the entry so that a subsequent allocation * does not consume a reservation. */ @@ -2713,12 +2714,12 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, /* * VERY rare out of memory condition. Since * we can not delete the entry, set - * HPageRestoreReserve so that the reserve - * count will be incremented when the page + * hugetlb_restore_reserve so that the reserve + * count will be incremented when the folio * is freed. This reserve will be consumed * on a subsequent allocation. */ - SetHPageRestoreReserve(page); + folio_set_hugetlb_restore_reserve(folio); } else if (rc < 0) { /* * Rare out of memory condition from @@ -2734,12 +2735,12 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, /* * For private mappings, no entry indicates * a reservation is present. Since we can - * not add an entry, set SetHPageRestoreReserve - * on the page so reserve count will be + * not add an entry, set hugetlb_restore_reserve + * on the folio so reserve count will be * incremented when freed. This reserve will * be consumed on a subsequent allocation. */ - SetHPageRestoreReserve(page); + folio_set_hugetlb_restore_reserve(folio); } else /* * No reservation present, do nothing From patchwork Tue Jan 3 19:13:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13087917 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 DA5D2C4708D for ; Tue, 3 Jan 2023 19:14:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C3708E0005; Tue, 3 Jan 2023 14:14:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F3BA88E000A; Tue, 3 Jan 2023 14:14:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCCB48E0005; Tue, 3 Jan 2023 14:14:29 -0500 (EST) 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 BBB4A8E0005 for ; Tue, 3 Jan 2023 14:14:29 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8ADED1C631D for ; Tue, 3 Jan 2023 19:14:29 +0000 (UTC) X-FDA: 80314439058.23.6A773CF Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf04.hostedemail.com (Postfix) with ESMTP id 4643240010 for ; Tue, 3 Jan 2023 19:14:26 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="wvf/Ougt"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="MU4rvb/j"; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf04.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") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672773266; 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=bSfzxdeVDZnG/rkim5bvLm1bSYWCUMIGGlbWdlHgVZA=; b=lg3+F4hk2efqOlF/o+l5DqoGyVdDs6EdKCjhzPYPdxg58OW4y7readtXqH/hOsnHkUtx2h LPX6TnKMNbXplv4dvKsh33vWWKBjHMMC9NjsB3W6EMFojWR8OSZTwYs/Iq6hrtoz3jaJUI JXtC//VKjDwtRAS1jZW+UBRbiDqDEM0= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="wvf/Ougt"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="MU4rvb/j"; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf04.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") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1672773266; a=rsa-sha256; cv=pass; b=qTmjPK5gWShVfT7/dKC2PCP48u+npkBY8GA885xdXEEgQEE5pSzq2BLAmPQVFmsHfv8/wy bZafXqX2nl42m4UZkbp08XN8YHY8YIA0VLZ5Zo3kRfoYREXitvk7T8DNQ/N0U6lyY940cb vQLtggNlhVdfWTkILvVqhUD0qdkrBKE= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303JDtWX019338; Tue, 3 Jan 2023 19:14:02 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=bSfzxdeVDZnG/rkim5bvLm1bSYWCUMIGGlbWdlHgVZA=; b=wvf/OugtuNJlV08zBqNHAhf2cpExRE6YFfgljSMwIbR2osyKxpLlUKjdszvyoszDIJha CVEJkZ5Txzs0aJqYKKHsW9FAjboapeQRaYH8s2I3mNttLfQDrVgPHdhg1MIYaZysf3AW 2gcsDbK1fw4oqOH/TIr9JOxbww89a1Juh6WLlQMsuhP1DwlNFy+oA5egCzq2vuM59ucZ Pg6v2S4zJTCF+6qhJr5k3tJdaBLbEmSIzXfctb2IMV4RnsvLjwI31bM1nS/blb2ssOtp qp5kDpE4KR3GgPEJX8AXmpm2bXuQuAW69GOrCI9zixPbUWzgiw7jwFvA3h1dmumAu685 0Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3mtd4c4xt3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:14:01 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 303IRYA1008948; Tue, 3 Jan 2023 19:14:01 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3mtbhbrvua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Jan 2023 19:14:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AdMvLqP/cF0EVeYZ9cXY+ySIvoUQKjtfRqmoQvspvQlhKpXyG+QN2/IDXqc05WOS/x1yvzWWNw9FjRLXY0WV4Vln6M6qXJS4PfqwcnlUFDrJ1yxrO+6Cr7dsq0wEqSZKVEItJF7p7li3DasfQNFU6MFa06M8xmQqCsUSvBpdZ9SVNmC505ss4uTFIEUsUgyzDAWp1eylrcW/DQlnSOOchROJK3vdBfV9FXWsT/xF8S9ztk5TZPbhZJTjxe9knZ7TS4FGbs93UnfQtZ21npnRFjAtUnvSl7spljaZYCBP5W8FUse+nWpiCR7JtyrejO060YVT4hMlNqa2m0dL8xvigw== 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=bSfzxdeVDZnG/rkim5bvLm1bSYWCUMIGGlbWdlHgVZA=; b=RKrQlHGsuXfyyMqe8B1VA5SApYa+WGWrOPVj/M7fXZ3XlNHIR+xL0IGCiG7d+uOQGRU3vluppQDa+MH4FpW/+VLSRzl2W0Zq9+XnDmuDdH6o3EKGj0Ck9wxvrDvjwAtezb0MU4qppdHOMcgvRkv6LVnjXpRJQa8MOFepIHv7bPILaxtY2rYWvrq9omVCT9724hh6HtgT05IQ+ybpg8z6gb+hW9S+WHriun3FqQ0E0q+pCEcd+yqw4adb5jufpWI1Ho6sQCPU/YUzDGYG4lbmORMuwS5uLcFgyZlFf0P2mUHZF3q1BN+ZqH8+rFNfXha6aBNtq44oZYNaNfd8bqozZA== 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=bSfzxdeVDZnG/rkim5bvLm1bSYWCUMIGGlbWdlHgVZA=; b=MU4rvb/jDpnSipDt062zVv6B+9FhJbrS4PHX83o0Sfft5vskossYu9hC6o0yCNskDClp1I+g2OGEnhBLPcGyiTqNuLJfbrvjlAm6hfbUjFo925eFUijokLzN7xKIB4AgOZBzaHDyt4d5yl0lZ+4B4S5B8xNLw4tPrF8rcni80mc= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by MW4PR10MB6487.namprd10.prod.outlook.com (2603:10b6:303:220::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Tue, 3 Jan 2023 19:13:57 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::51be:1301:5ec3:996f%9]) with mapi id 15.20.5944.019; Tue, 3 Jan 2023 19:13:57 +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, tsahu@linux.ibm.com, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable 8/8] mm/hugetlb: convert demote_free_huge_page to folios Date: Tue, 3 Jan 2023 13:13:40 -0600 Message-Id: <20230103191340.116536-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103191340.116536-1-sidhartha.kumar@oracle.com> References: <20230103191340.116536-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0447.namprd03.prod.outlook.com (2603:10b6:610:10e::24) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|MW4PR10MB6487:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d168594-b4ab-4df0-38c3-08daedbea98c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dgcowUrglrbUo32NH2VlkJKXYHYk6yCxCtc+hxUv/O/H9IjpLEqYjqmUo+UTR+nncaSqphPfiR2gFQNhJTP4bykLgryBY/bvEWGv0QYqxpqieDGS0JrREwWqvwwhxlzgI9dg0ghSs//d2C5fpd+0ADBEkZ2BHPfm2auH+HP2+1quFSiuNJYUsqirNAq4ZGgBoQ0yaOz99FF0Xhd7sP0qhs6VZrFdGFH6aenHPU12R1w+JGaCPxgIizHUZ4rcsp34zHqHGIxqWJIZXfsKQcrvbmLMgsFJj3maOA2WotbFlAAb8uHrMS7rlfO8cMXiulnnTO6ltyKZtF8MS4uRnDTCzjXkMHNG8xEHofn0YWsekdozJp6L2o3t+0EXzsutCeRiJvsSmM/+cHPUwEl4qoEkvMDXSO6BKdzVqEpqVMfHMikoj64L5VuPgGJhOyQDBsc7Z9o321UddZPGEevrCZSs9DF1DVV+pVM1XMsbDPVusVytXNszTNtTxCS7iKvmEjpgVtFQbbGAh2/5SbbsEjC9LF5VlV1BpHkm4Yw0ZS+9wa6+FU3JoMTr+czmUa1s4fRxxFKczSFHFeT0gpLvtHn+5JfijpwaA7mQ0it/3AYHaYLnwrelwjqtHslpv/gGPuIyFPIJstK1R4dg6DPDpmzwOOwIwp6AhFpxFL58lqJe7cpIg4z8oQof5HdO/vhAgojmBBi55HHFn+rquT+kn8co+g== 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)(396003)(366004)(136003)(376002)(346002)(39860400002)(451199015)(38100700002)(36756003)(86362001)(6506007)(316002)(66946007)(66476007)(2616005)(6486002)(66556008)(478600001)(6512007)(26005)(186003)(107886003)(6666004)(1076003)(2906002)(8676002)(4326008)(83380400001)(8936002)(41300700001)(44832011)(5660300002)(22166006)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5i6rMt6LujJEPrHL77bq2FdqqHZMjRWRz/UypaQRaNwjbWkraBcy+meHjR/jennZvquIjsK/OMoYpKBMz64EZirpS+TUxM+QEaSOp7ywRRhQgj88gZ4Mkz+gIJDm9/Sjl8imW2gnGYIbP4AoMfVqHkeWChqZhMQWDZ0AecmkX1FOq1nc9nAfXwq8xpvTOd8nsTI/8bVK/axWh9qS0Mzdhlj/MXtB4f0HZg/IxDx5BbKn5h245jIW5iDlejzVyrFoQfRRuPTOppDfxJ2m38zKQ3TYGitFQFD0SycdyzBmSRFSnW6TAgk0efWRmmDOP+Esdw8TK06xPc7XsTp1CUUiouW+nuJcdkMC3fm7YFTuc9onCXbhkJDSy9h6RdJXFIpJjLzO4omt21Z301fiTy5OUGOIAyv4GP/ntSgk5fnDrAd7BAkliLpBlqv0N4qCh2flRScnBkZ/ebtCv1FGoPZgoo4Cy6/ND357BgnZibfJ8NYGETw+uDi5YXerz0EVrUFJPb0BIcsfIPMNzJ4ITyOcqqAmtSd/YpSkdsK0aWbzqE0F/NK8wZQF9TyY6i/RNNn6MUj9IN94s0lzOUEsQavS0pW5/rlm7VSrHL9Es7jeBc1ANyc5s3lMOC78dTLTeXf9YdBRCD/mXlYZfs573PvPIMgfCxVTyaTdhudTqablr1Anilo9NaA6Cw7BcwdmJVU6o0qMJCdaMtWchoe24Ksu8LAa+iAmyw46aVxJeXgP4r6G7JociXoi2Bq6fvpcvVpV0hZxC6tDeETKbZXMXsS0dsx6RO0qmA+wj7+iegaWzb+SEZ75U1jb2UFyuaJzY0hoyc6it2k4ksYESMdkVoh8KYPG7mKBI93fcTsupw2+g6Z8lWbvTEQL9qCYh3Xuy12RlJmvo/pQhZErpNgkcGA188vhGBEoXo9Fays0OEUk0fqW0qo7XoEQRsPejwlF5BDOCix0Ni8dLNvBWUYz7vcXacbg/koUP5J1luXABJvFaCs7NKwso+VSUq2aukSwO8RV2chPgBgjzVHTkL64e0dbDkDf1acpYsKKw4O+Erd6HtO9w1mwOROiFswJUmuHOx8do/7wSuh2EarFCC0OGTlM6Ifcoh6QbFVd0yffiTeZHN5q5dQhizY+r4Qvctli0dWYG0RwNgUXQZzxBZ0LBxKJkq+dRwnHGUWht0elftfBwDlViiHasNQB5RxMnIa+IbOn7t3RDjVLWLSMM6jdQ6HABUw6y3EV9U+yEhJvdND/8IAaOTyA0F8ogUjoUusG/KBC3Q3F1lcYTfFxSz3njNBrKunJlwSr7VyfphhUZl0qGdzep6qqAFn3+qxqLRxEO2evxF7hObUgOgbfRebca1ABYlr4K4zgZLzEXr/pg7w9QrnPh/pa0evvam826s4OiacVzshfIa77+JdRv3vp3IiVlWfzgovxykfqmaJhSgdV7P4+rM6siQvc3kTrKADgUHjQrT5F9jdkUc3M0tRcxPnkyZ+ay1XdDAUsip+TfUnNWYCnWDnk8MZ9Ltgab6YCJyDhtn90CJFKJcyRHQ8PLyPDdRMpB/cIq9q43u/x0zES2qaRYUG+keIPce8OpmJBLhBn+4NcYuc5UjKja7+GsstW0w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: vTvgQ+Q7PeP0ItJY7i4MGHrsDlNkmTSpSUII785BW80W3372O385HN8xGcx0uhORzdVvDrR5yqhLNIpHtxGq45j9W+WIxOA9tITGAQGaLvPVTfmdy9jMxRNFm4oeRREWEpX6Re7K7kVWaYheUZvTt9wmYNyKfUVqmxWtNQg4FZmeBtccEzQew4hVuyHC/Bx0AobNPn7XCizWps2p/+LZ9sTltJAT7I6/MqRejiamHpt8LBOgbMIYJfIriZ58zO5MM0PEN81UioRNSkgwIh7ZZOnLsGDm4RnLC+rDU8W/eHBlojH8cFqd29xxs2HA7z5XvvlPaqe4Vfql0nh+sduYaBO9x5wOiOX9SmypgbnH7N1DPvYHsOiqW0nnKz99S/kHz1EWke5mp85fA8rb0SemGbafzNy/S/LhB1AWlx+aaTwDrtdN72K+PTtUYLb8CZoZGuB2A+Ktr/kYxS+xAg9hB4V4sDUHXB+UgfEntQNYFRHxkSr/IoeJTU5Yo7pYwe75W7oe/E7+BCLxaKRguT1x7i4JJSgVuRbFb5PG0ZsR84AbDy2ejwLgu1c1OPM1r0TrUvY0b5UCoBHq3zyq9m1JpqzV81g1cr46xYWDyl+2/2yl2Q1rL+b4gzb4SLCMHR8aCtPje/MBf/liLIuO/eMJtU2ZZ7wX3ScYbSsqBMZLDvQU5bMGAsy8yEBfZRoddoepdxhXQGJZXGflMWM4pfDFLZ4bMZAw82P2/1rUhfntXnCehZElUZH2hprCunXueXL6VZazky98NYhW7H56pAR1FJUW+mgZRWH0AzYxbTKYbrj5u6068P7ge8JDAyq+ma0MwfeRyReYdXlbUYfa2lEof0JThkvXlO8fy2DXidZFvYDDI61D5zphrFuSdh7mLfIS2ZceZTSaAA20zx2jqeC9u1wd0rRrc8e+dkqMX3qBieN26JplvqrmUf6FLQwuMf5TWCaS7D8eGeZaJLtyZhUxq7WjgLI1SvSJ03Ahz8uqqMA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d168594-b4ab-4df0-38c3-08daedbea98c X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2023 19:13:57.1392 (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: KIAoqIrPr6tl4z2DdF9yr1kxDwr2oLcsp8f66jKsU70xn6Gqhd3Tn5idzf2pEF+Ep8DNJPuQkM6dR7PNCl7VEmgmdKpaoHYEse4HPeJI55c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB6487 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301030165 X-Proofpoint-GUID: neVdGINwwXt0uBuZYXJUDeELV306vcft X-Proofpoint-ORIG-GUID: neVdGINwwXt0uBuZYXJUDeELV306vcft X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4643240010 X-Stat-Signature: hj5zmsd6kzrrf15i6b1769em7php1dgu X-HE-Tag: 1672773266-878267 X-HE-Meta: U2FsdGVkX1/XKhXqPgfAgtxbIoK23KdcTYWN7qUfrKGVV8EZ52cemLLLteG88s8IsRkpUjKmDW9XUMHNeBmk1GScTvzW6EsXnqliCq62AK2iNekOzItwkJcNNVnmd0oHaPGHMRuJLDHwT3FxwBXd+DtvNTVteB4ag1o9TNTCCrIUa5o2SxfpscZ7H6FkvLPVcOKlaM2a86RM5HMkBH5P3H8zqIBURExAy7PgQRYoxN2yT/jJM9Kwi+17y2Kg6MiixkEHVKtwXltsPc1ou0idSU4M7/TTN0rL76NoeZ9To/1NDRgbnJY8H2CWN9eyBckRrdka7Bkd/gv2J8kh3bKIrFN7OFQ5rvKuradfeleMFG/ZHBo/oArBOwM7XhiPuDgNQjiJRijSRV+l5t8Rydj3ZP5fCxQpPT1sexnxw2QoxRitdi3swBXShYFRAZfH2ZWPoE869E1kwX4gsgLnMoPXWjjzn5ru9CVDteqiGoGcJhtXSraJ4Hji2lAz0qp4MnHgO4gkHlA4kHg3pODy65g0yQvKRKOvSNREl1FTB9u1T9JoPxteiFd9owtPtlkv/5D2GAQdDnVvz8OH6YSVM8Yh06/S6HdhcyMzZuikZ4SIyzT87LpaLOLoM8dMvqwMljRUn8nGIgcCYk664L253LrA9Yyz258/0sUArbzt0mpACZJi9ZKKAb8Pr/QaQ7SlulvLLMmdm1PHbq5zYRKRY3pNiDsDwab5IZCagg+gca10eFxI9Se2LKtVC2KX1UqYGHDRNzqbGxu0fUSmkgKs/arbFfDP1wJRXR5qEkjo6xTPcdn8ZEfVRgEhKm3RdLp+17fRZUGyZWcmHSTNUe3W6vTJ3YjrSbsXAHYcM316c5Gc9O4Ss/d5Wt0NtApaq5wx+44wLwPIGl9PwrwKotriuyWte2ORAN5rf5Si/dw4pDtrcH68wgJsaFjnkuB3snLDucksEqwvaB5XNwkZCM43gl8 ABxOTKEJ KszfS0VCgKaLatDzfx+tIxL1WUAzCymWCt98mYE/BaJECNCNR3SUF4249bCKpJwMryc2X/0/NLQo8iB6Ngcp12KcukIgBV10F0nv1WwALrgZG/maV66gPrqB+/4DjWwbVZ8MgDmR50MduAU6GGEakPNSU8w== 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 demote_free_huge_page to demote_free_hugetlb_folio() and change demote_pool_huge_page() pass in a folio. Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 2bb69b098117..a89728c6987d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3438,12 +3438,12 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, return 0; } -static int demote_free_huge_page(struct hstate *h, struct page *page) +static int demote_free_hugetlb_folio(struct hstate *h, struct folio *folio) { - int i, nid = page_to_nid(page); + int i, nid = folio_nid(folio); struct hstate *target_hstate; - struct folio *folio = page_folio(page); struct page *subpage; + struct folio *subfolio; int rc = 0; target_hstate = size_to_hstate(PAGE_SIZE << h->demote_order); @@ -3451,18 +3451,18 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) remove_hugetlb_folio_for_demote(h, folio, false); spin_unlock_irq(&hugetlb_lock); - rc = hugetlb_vmemmap_restore(h, page); + rc = hugetlb_vmemmap_restore(h, &folio->page); if (rc) { - /* Allocation of vmemmmap failed, we can not demote page */ + /* Allocation of vmemmmap failed, we can not demote folio */ spin_lock_irq(&hugetlb_lock); - set_page_refcounted(page); - add_hugetlb_folio(h, page_folio(page), false); + folio_ref_unfreeze(folio, 1); + add_hugetlb_folio(h, folio, false); return rc; } /* * Use destroy_compound_hugetlb_folio_for_demote for all huge page - * sizes as it will not ref count pages. + * sizes as it will not ref count folios. */ destroy_compound_hugetlb_folio_for_demote(folio, huge_page_order(h)); @@ -3477,15 +3477,15 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) mutex_lock(&target_hstate->resize_lock); 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); + subpage = folio_page(folio, i); + subfolio = page_folio(subpage); if (hstate_is_gigantic(target_hstate)) - prep_compound_gigantic_folio_for_demote(folio, + prep_compound_gigantic_folio_for_demote(subfolio, target_hstate->order); else prep_compound_page(subpage, target_hstate->order); - set_page_private(subpage, 0); - prep_new_hugetlb_folio(target_hstate, folio, nid); + folio_change_private(subfolio, NULL); + prep_new_hugetlb_folio(target_hstate, subfolio, nid); free_huge_page(subpage); } mutex_unlock(&target_hstate->resize_lock); @@ -3508,6 +3508,7 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed) { int nr_nodes, node; struct page *page; + struct folio *folio; lockdep_assert_held(&hugetlb_lock); @@ -3521,8 +3522,8 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed) list_for_each_entry(page, &h->hugepage_freelists[node], lru) { if (PageHWPoison(page)) continue; - - return demote_free_huge_page(h, page); + folio = page_folio(page); + return demote_free_hugetlb_folio(h, folio); } }