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: 38616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779182wrt; Tue, 3 Jan 2023 11:20:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXua5AJ0d340QM/xk3YeE5OAh9vtcmPKaFjeoWc5yF9Uk4OiG9K2FVS3RPQN6b1eMO7PQDxC X-Received: by 2002:a05:6402:1759:b0:46c:f631:c0dc with SMTP id v25-20020a056402175900b0046cf631c0dcmr33912182edx.12.1672773645744; Tue, 03 Jan 2023 11:20:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773645; cv=pass; d=google.com; s=arc-20160816; b=YDVEvhPDDg5R2fcoRZYPjYEZj5nQOHJB049kZRrs1c58qwsfGvuQaN01NENptOggWS WRIhCDuMb+PGJG8yjF1KCNVWYCOmQ2nI81/v71Idx6GKShtzilzLh9TBjH0afEsD9mYB gHCLGtLhxI0Ob8o9ejDpzVulDNtwdhnmn8KWmrGOucISr7qdMulxl5xHxWM0ws3gfGLp eso9oZTL9ux4X2ecNgMr0/91FNWaBxjI2XS/Svdn+PagINJbYkQBFPE/TFdXpyoSc+y8 Du2Zetd/AuCNvFiwRZXbxdbmmNvv9Xygnm0edepn1dAQfVGDvtBe+cAtsgXVtqG96XX1 dFDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=W8Gt85xMEtaiuPPD2gNNoJcGHU+DxcUImoOJ0P8kcsk=; b=dvKDzvus79Lc5KzGTthDbZK2I7wt0Jbjlgkr0T2ovEUQxDKzkGl+ve0idGMxplp7/p fjQzjEQffvIAsspCsJ5MGRQi4rTNLG5YUp2SOA6I9JC5xD8InHo5qYJplH0kVi/PtO3D fNYrHQcfM35sRNdlbczxZNnZW3FVG0lZ7gAuMyeh8UQx0uSZIeRXxnVnMm2CFzhqLaK4 0YWShdz1T7Ie7yU1E6tG5HYVi343a6jctyeFU/sv7Snn9vR9njCac/ImwA9qzq8CxTmB yvHkzW5EleMmAulhmSaGQQ9qycZZP2ifVac67lrUdys1jBKq/5YaeGj5EzWJ8vX5lrxw mqHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=U9eypNmh; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="S+GJJ/VD"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a50fb0a000000b0047deaeaeb4fsi24096158edq.97.2023.01.03.11.20.18; Tue, 03 Jan 2023 11:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=U9eypNmh; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="S+GJJ/VD"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233839AbjACTQu (ORCPT + 99 others); Tue, 3 Jan 2023 14:16:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238943AbjACTPm (ORCPT ); Tue, 3 Jan 2023 14:15:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C1614029 for ; Tue, 3 Jan 2023 11:14:35 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030298053484788?= X-GMAIL-MSGID: =?utf-8?q?1754030298053484788?= 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: 38622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779607wrt; Tue, 3 Jan 2023 11:21:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXvruvA5/SPyD1o6QQ2Xsrw9+7ERw8k8yoeRwmIDO0C9DVSuHNrOMub9SiyzML4nMXvw6u5Q X-Received: by 2002:a17:907:76fc:b0:7c0:edb6:e55f with SMTP id kg28-20020a17090776fc00b007c0edb6e55fmr40048311ejc.37.1672773719632; Tue, 03 Jan 2023 11:21:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773719; cv=pass; d=google.com; s=arc-20160816; b=JUEuYsQrCZZhJfulWp34WjdrVXRK3+sVQQP55W2ws2znUyLkOvg6R0dL18edbWsZmw b+tTzq/eHc5MoAfMEtnzEJy+tMQ5kepmmDMsW3bByTVzHttPdtpfGXdIUp9YEGrl9CW5 zKDEK6DW+uJDV6ClcHQEygPTB9qIphxj29XtCmUyK0PaZ1xFnKtZqlxGGp2dU7a+X0L3 APY9R/bihhajFvjYfRxw31hq5iN3C0bq45qRGxQMFO46vQUeoGQwcmGFAYZhB2cIVVoD sjUQNt28+2YvCOSvGcpDb12UB+17VMvDy1U4OM4YIaHZEWELO7E1EBPbuXTVvmwGKabr fOLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=nmxhlfpLfRSO3dUF47ZIWemR1CIptCOWAJSWro+sA0A=; b=lkZxoeUrzBnQKDpz3Z3kJQeAqSP8VkpyiRQBhH0ptcM0pIhlCpogUSYTnimbW3i6X6 S6FFyt4HiUS7mB5Yy9G+OtoR6cnjiIYTW0uuU7muGbdHG9JTS+PzHvBFuIM8HXg9Iy5c Y8Ye0rImIZSLX74hZw3OibHpi3oI0pEwJVoRvF6tgOiTdNJ4PswhY9naSIu3olT8iGoh Q8wtE/ITQwCN/69jsKW0IwRzuFXsC0rUQ4//B98gd7odRihEkNO/clURBadekzIqdMf+ uoOFx01KvrlAYEC8I4bpmhBehNEHG96quoyxNgOYNjcG4AN8HjHNYd3SdgpZGubm/9q3 400w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=PQHTlecY; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cwzq+vAj; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt15-20020a170907728f00b007c0bf7f6845si29444871ejc.619.2023.01.03.11.21.36; Tue, 03 Jan 2023 11:21:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=PQHTlecY; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cwzq+vAj; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238731AbjACTRE (ORCPT + 99 others); Tue, 3 Jan 2023 14:17:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238939AbjACTPm (ORCPT ); Tue, 3 Jan 2023 14:15:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B1A140E3 for ; Tue, 3 Jan 2023 11:14:32 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030375976109692?= X-GMAIL-MSGID: =?utf-8?q?1754030375976109692?= 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: 38623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779621wrt; Tue, 3 Jan 2023 11:22:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXt/6GMpsNtDN1FQe2egZHRhRhisYX/XiO1l+s3+91BXM0/nQ/TOAgvMFC9L05ijE3hh//JP X-Received: by 2002:a50:cc4c:0:b0:479:8313:2fdd with SMTP id n12-20020a50cc4c000000b0047983132fddmr41709451edi.10.1672773720547; Tue, 03 Jan 2023 11:22:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773720; cv=pass; d=google.com; s=arc-20160816; b=KyCLYXvmGCbFce7JpGTkj455AOsDPDjoxmGntKLcP84vbBNEUpmvTfN4KwFkQvfr4+ WD6SsdeBWoQBL7yE0vWBBZ6l7WCCmfAAB9zDiPu5sloV3QEVljq4ZT2MLnIdt6IY4WXp Ql0h4/N6NKI86utHyKCSEvRkkXy2uCc+v1xEBNfyNrl8ihC7JwFyL6p5YA8ih0BISF2+ iyCFVZQWX6ZX2t+e5nTij/SmWDapKid25fQ6o1iqs4TNASpXLwKrPScD9fAFpgh5v4Cd hBFzS9tyFegaOQSN3lV2vMD5pOJqkbYW/0MM4ZfbarfzvjXO+XOfs1UhfMCaq0z5CAt/ KDVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=EwC5Tm4tgFzepPQEIJu9ctB3QRjFntVvmEbyFza6K+E=; b=Fjz22JfXAWVqkCivWU/akAGZ61AWI/rlaDcyJ1gyQc1x3b67R2GV04ctSxE1giY3Eb DUIXbyxztZcRH9J5nO1OpfpBvlLynjjq/17WnrMjjwUe+xloDSan4dx1fw19kky2sJVA jg5Yz3ZcXsTslGURukU+8siWuY8UUK88w1DcSgyfa+gybgn/X/1mgtpq6D/2HJVzRlqO 6VKCqI3UkyCuI7IeYkqvUj6tPsvMXAuG4hjXo7bldhIXjhpRSsI6EsKZAdO/9euFaxdS 78QaY7bPkkuBcXav7Tq7TbdTnxTn/QVz8Te0j/Jn1wbvtRj68aPSwycBgwBxDgkF4d38 xQdw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=nBNsu+oP; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QFewjOTF; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a05640250c700b004876785ef7esi20857722edb.489.2023.01.03.11.21.37; Tue, 03 Jan 2023 11:22:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=nBNsu+oP; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=QFewjOTF; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238831AbjACTRM (ORCPT + 99 others); Tue, 3 Jan 2023 14:17:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238930AbjACTPk (ORCPT ); Tue, 3 Jan 2023 14:15:40 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C27313FA8 for ; Tue, 3 Jan 2023 11:14:30 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030376793723964?= X-GMAIL-MSGID: =?utf-8?q?1754030376793723964?= 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: 38618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779262wrt; Tue, 3 Jan 2023 11:20:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXtj/DiJc1K4h6phrQLjSipMkAStRTCxJE1XFa0G1TE1+tCoIPwyjUZt/Pl54NuJ4WchtCFB X-Received: by 2002:a17:906:1c59:b0:7bb:af66:f38c with SMTP id l25-20020a1709061c5900b007bbaf66f38cmr38910940ejg.10.1672773659200; Tue, 03 Jan 2023 11:20:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773659; cv=pass; d=google.com; s=arc-20160816; b=M24p5dkYRE4A8NmNdlAi2Za4+QR7ZSCj81v1khH53NWVAUhmOBzOHohJOplVldmhkn zPq7MsNtY8xMBbbNPiYomcIe9dVfwoOYAh/oB9thBf7hDvU4+n/MenHEqAOMZUU/V0l1 8A1XM91c/h1J4wZ9+/tzaJaTFU4sEStkNMqoTAXSe0My6qaKaVOMBCgWksreKv+/f5tx tFKdNH6el5GKCyq1i9avUl8Qibg3ZTspfusfOyaM7RdyTYQpwAVspmS2bWItNgrKNrSo WGvDCyvZ3Ka8CMCAm9OjZh4RG5cTc5GsXVwcplpZ/Krpo4TDJZy3jI+zHR2TByknlVXm FQxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=Q/ely+APh40QA7PIqRoFk6Hlp8rvygpoGpgybXM+zlc=; b=CGmz2BImFxBmqf/lwWuE6yg3L9o6R8a7HTVyrjd1uShcrrwuQw/N4tUjxtokC1PsMV hcnS5WU7PqP8gJLPMFRXASw6/YbIi2Rv81xr+crhNp4gcXudhf61rJtjJtE2HnQX71IH DyL/FDGzf2SgofyZtpY7v6SjzbIVUE3gOC2cqUiMekCvjdHdULk8B+Y4YtpBSlaD8DSx Dwj8OpUOxF9txtc8j0ldq6dbBttevDhf7S4WjRsYN9OosNUvSSDpGoSpZLnJBbx9dEgT 5S/QCa/4LB/p3LMMvxWTaajp4klU2uJUpmzOLbWxE9TGvRLD7gFzEYMRir5gI/oBbqsn UPbQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=wSeRFYur; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=FfV9hhUu; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js3-20020a17090797c300b007bd112b2764si28946478ejc.381.2023.01.03.11.20.35; Tue, 03 Jan 2023 11:20:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=wSeRFYur; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=FfV9hhUu; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234060AbjACTQf (ORCPT + 99 others); Tue, 3 Jan 2023 14:16:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238923AbjACTPk (ORCPT ); Tue, 3 Jan 2023 14:15:40 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB3214030 for ; Tue, 3 Jan 2023 11:14:28 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030312540849144?= X-GMAIL-MSGID: =?utf-8?q?1754030312540849144?= 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: 38615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779121wrt; Tue, 3 Jan 2023 11:20:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXv5qk1+4uQ4e4LltpOmz97998EwjYgsLdBKkcZLTlzAAyD+jZcmxX2zAlXHvBIPpOTuBkJk X-Received: by 2002:a05:6402:1819:b0:463:c960:7589 with SMTP id g25-20020a056402181900b00463c9607589mr37050658edy.40.1672773641565; Tue, 03 Jan 2023 11:20:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773641; cv=pass; d=google.com; s=arc-20160816; b=bHtGf3pmwrjK23qRhNbjvXnxaM0Y8JzHKYx9mjoN6pWpkKsFP65msDEi4/ZNd1lS6e kbkprWLc/LUrQ6kQJj/+ppFQ4AKRuyAWp/UhUPyK0Ic9kcutrwRrktzKH4+idqHm9hpa p4P9oFUeFykMSA3IZxz9hIUb6jbtusDhaEYDFYY4hupNx/B6JZjN1q7IvdFSGm7F1FMi 4lcF5XGHfrE9AoOWmIThAlvce//OLTuS+PfDFup6nTarVvVe3ybpVHQiREAfIt2YgFeI QDlb2AGDF4pkTmwehTRryPuiDoLmrD5JZnda6F2zVsSNFRr7oWIyc6/imP9Co07lODaK 9baw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=Fo1RxbKBNEh+3O3z+QHKut+Np6Q7TabFfVnFvfxT3m4=; b=bAgD8/AwMum8gw4i8NkIancOKrokn2FNfponp9Sr7dJ9I1zhejoKM//UpemlFVWWpM 880I6yObWGw+/DhLpU0dWZL01WoNBAJO8zvNeCL+MFlfvg0pPGGDT+Amyp3eXU1tp9D9 3kzF7BnnCGKytFjievlu0zwPtwkoTc0puSUUDRaS791daILXVR/ZQVOwZaQU0gIHjaUW wYDxgnvRTjoB1skAgT4SvIPr0YgGhrcmlthoIYOxSoF4AJN9x+2Tei+fDPhNtYOXy9dT QtIJ5yYXMZPj8e5b/Z1h4S/KCbyyNMX1PVaelf9Pbg2jWsQ/eXq8tw5JOV+lExu/t/Aw lSeA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=N04LDY8M; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pxhrLbbG; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a50cb8d000000b0047f5f2cefe6si24861265edi.179.2023.01.03.11.20.18; Tue, 03 Jan 2023 11:20:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=N04LDY8M; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pxhrLbbG; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233549AbjACTQq (ORCPT + 99 others); Tue, 3 Jan 2023 14:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238938AbjACTPm (ORCPT ); Tue, 3 Jan 2023 14:15:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B67140E5 for ; Tue, 3 Jan 2023 11:14:32 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030293622054170?= X-GMAIL-MSGID: =?utf-8?q?1754030293622054170?= 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: 38621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779384wrt; Tue, 3 Jan 2023 11:21:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtr4R9DBW7VaaKyGr3qeHXWZkfLC+6XkfJnHsVJpYYKloDwe0RrUrhxNVfnlHDGA4aFg2bS X-Received: by 2002:a17:903:1c3:b0:192:903f:7ac9 with SMTP id e3-20020a17090301c300b00192903f7ac9mr40531589plh.42.1672773681509; Tue, 03 Jan 2023 11:21:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773681; cv=pass; d=google.com; s=arc-20160816; b=XFxh0WqSQk5cFd8P1PNEnqNTBONjhJ3UhhJ/61Tk8AM5m/fXoFd8XuZLXG6q8DKzVa KwZ+VzJ/xdlaX2RAmBg/fOonLGQghK6QTxG9FBwqQH35KwHja57YAEv+HPiEJzUPG5cL ZQDN8rsjqn529H2VT+KQ/ZtqMgTlr7HPcbYEAhcUWzmPVZR+ruibDX+wacWKN4W79VSr gMwqOwV+qc3t+pNtnqTl06KOySSdZMUPvjYxUETJ/HVJjTJDXX1t3h+G9Y3tr0JCvnFi 8xgc1zfb2anBi6EJJ5hMU/Ce/879IQk9Bxijn0/W+IoudauDCY2+OJ5EdBkwRQHkAIZn WTgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=Got+/JhlEbn00M0JyDO+i+N0rLTksWw+LVmAVXZxyq0=; b=UFNRYRNB/oDkeIskIowKj89mZkfVWBiXEl8/7aesa7Or2rfS6haSIUkaQf6BUH44vp EzXZE/1m1kda8v1xyPUma90sZHQzzE1WJFLCby1N+MGuw4vie6LOR7pRERxD+iLmPgvr bc2MBBmbGD3Y1nIsPcl3WfHYKiPi9f9fibr5VFKYnbcwwjgohdQy4XTSG6vw3Hbevlud n30qhvSIJldfB8Gl7S2t4p8jAuFz9xr4XZjzPRsPcYKcqX5LNmLa5cGa4UN+Mtdkoxgp Re3NeV9vdGl9s7wByhLj2UduRmDEJSc1TEe1PsWMLm6qqlvvOVujUGUrG+7AyL2EDlwi 10SQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=sQbix2s5; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cu8CCfW4; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a170902c1c500b0018537cc29f9si31556144plc.15.2023.01.03.11.21.09; Tue, 03 Jan 2023 11:21:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=sQbix2s5; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cu8CCfW4; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238994AbjACTQc (ORCPT + 99 others); Tue, 3 Jan 2023 14:16:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238924AbjACTPk (ORCPT ); Tue, 3 Jan 2023 14:15:40 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C2451409C for ; Tue, 3 Jan 2023 11:14:31 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030335545603947?= X-GMAIL-MSGID: =?utf-8?q?1754030335545603947?= 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: 38624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779715wrt; Tue, 3 Jan 2023 11:22:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmnAJ5WtH0As5Uj8/gxIM2XKlHmSJbW5drZLFJLpzpQqMRiDU9laXX+b1nRw9+HT3EVHkr X-Received: by 2002:a17:907:2155:b0:7c0:c1cf:f9e8 with SMTP id rk21-20020a170907215500b007c0c1cff9e8mr43730976ejb.30.1672773728598; Tue, 03 Jan 2023 11:22:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773728; cv=pass; d=google.com; s=arc-20160816; b=EYb7inA6ehsqr66tIkJ+GF86sOG+Hmjgtb7+3fq8bRQRubDsy/OQKYUK8ou+iivKQH VXwr8q0Tt18HFAVcaTGEjyOt4MGMLant9KiuriOFqeGsBNKnzPNy8ne0uIVwca4L5o4s AlrQSl5qEi+RF5AR6rLv4FY9O+DPsQIsWk1WXRGbPoTlFyRvEiSclZoyGw7PkEkPZUvR JRHAzdL274mBVh6Z7cpS9xmrEXZqQPlzZ9mzgLIwiCf5URQgwPMmJodidPoxhTyJndJk CpnGrDsOy2I8L+R70E/3g0oRPK0mPeeenL8Y0tIRJN1rycRff39j1gxahyzDJthjN8LZ niZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=o1pwg8coY/UF8sIXZqLBGXJKgxdhtYJT0zB5UJI+K/Q=; b=0Cb7r39LQV7EEsinm/xOBDHaeMvuO3iwtYV7Cw4bCfMHC/nnsCjAGkyQwLwSLRbXz6 G7GqHxzNw0XpX0I/ABdBL+wxMNLHX+e1m8bKz3r9n0+ZOssXQL3pxadKr7Dq0tMWh1PY DDPCzv7Lqh3B5ehf4rgTALt7H652hXWFrcxPTKGY+hU7WR2GT4dyQOq0mtJTzA74hSz4 MG/ZQexcrPansrI20ylEG2fuHzmPon6Kpvy0WrdSE0ouYig0Plj4HddbaIq6wRycEf3p w/dzegtuWSRJf1nu47eZTwYo4GXHI1JDFlHCx7khvVFAqZMVLCnoIKCAQhsuUhu+IXs4 yf0w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=0o5GNMlZ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="KjSc4/JU"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji5-20020a170907980500b007addbdb9fbbsi29852012ejc.558.2023.01.03.11.21.44; Tue, 03 Jan 2023 11:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=0o5GNMlZ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="KjSc4/JU"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239033AbjACTRB (ORCPT + 99 others); Tue, 3 Jan 2023 14:17:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238948AbjACTPn (ORCPT ); Tue, 3 Jan 2023 14:15:43 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2AB5140E1 for ; Tue, 3 Jan 2023 11:14:32 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030384950943730?= X-GMAIL-MSGID: =?utf-8?q?1754030384950943730?= 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: 38620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4779289wrt; Tue, 3 Jan 2023 11:21:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvR7+iJCvNKU9uOKqvi24ZRKhifa58wTsyZafIl89lks557kcU0ss1HgKVayk/iuot+YiS7 X-Received: by 2002:a17:90b:3d0e:b0:226:59d6:e824 with SMTP id pt14-20020a17090b3d0e00b0022659d6e824mr13492963pjb.48.1672773663872; Tue, 03 Jan 2023 11:21:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672773663; cv=pass; d=google.com; s=arc-20160816; b=xlrdYsL6MEmCPPZKDv7GAO8Vf1jHueL5+vuMNAYYJFP76YQJmiYyGHAPC/nLAYcqHq 1KMYNgNGZF/HXTciq+WqFJMIwCjWZCaa6L+4dootMSKhP2p32f5P9QzJUQXRC6gSSUN0 XXhxC3HfFAX/gN1mnZg4vYhur+45jNtEogjHz4m9m8qNPemVX15OnV1nFK5/hgH6C2W6 Sbec9KsyONFzvdnbvNzWVGXzZjG5iBF3MbTwaxl3AyuUbL0DA0zGdq3qH5jCEeLKwZEr DfBkta/B6gjLN5Tc0dqRsFCRHrXoWjF9TKuFrPeYAcAullWAZdfPzgj5IZbwnUWBiGW9 n1Ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=bSfzxdeVDZnG/rkim5bvLm1bSYWCUMIGGlbWdlHgVZA=; b=PM7/EbhLqExG/z2yB1lxA7+YlSv8YGVWChWMUMoKA/1gR40+HbUUN9fYKH5TOpksLa BrspqIVWP05C7b0FtYv34uyjQKcJAAjvEAkN7uCRwKQhzq5cr99mIAF3fZS8VreDDegq bUYHN7135C9ytjwLFzXBOuxX7vZOiduO2hnJ9knvM2N/KXvrr0HUh5kQuH1JR/TSHGex DVnHMx/eoY3bu2hE2RX3Aj7K3aaW4wNcvtKp3NsJbBU7uQoa066TcoOjlMus2s2Ji2KF TqCmpT0N3QwGrizvD7vPs/1nZjouEieaAq3x5rNNg87AfqHIMJzb55wRgfduX+jfyJds ktqA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="wvf/Ougt"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="MU4rvb/j"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a17090ad34f00b0020a47a4c951si31415088pjx.147.2023.01.03.11.20.51; Tue, 03 Jan 2023 11:21:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="wvf/Ougt"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="MU4rvb/j"; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239017AbjACTQ5 (ORCPT + 99 others); Tue, 3 Jan 2023 14:16:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238933AbjACTPm (ORCPT ); Tue, 3 Jan 2023 14:15:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C713140C3 for ; Tue, 3 Jan 2023 11:14:31 -0800 (PST) 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-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754030317310678314?= X-GMAIL-MSGID: =?utf-8?q?1754030317310678314?= 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); } }