From patchwork Fri Feb 16 21:13:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 202378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp10945dyc; Fri, 16 Feb 2024 13:53:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUpUgsjmlQhS73jgwfNzk4vdtJer43Sit5ucd+/a/FCkenNtiQbxohQKZds+kWOE6BJN2zlwI3viyUfZQcU3ss/4Dnq+w== X-Google-Smtp-Source: AGHT+IH3lT1kDgBkGUDAJieDOjaFM7lhu2tR5CMEtnd9I34AN3ZASwFyUWGX2z9QZ3vIZNKlBQYs X-Received: by 2002:a05:6a21:680b:b0:19e:cbfe:3c8 with SMTP id wr11-20020a056a21680b00b0019ecbfe03c8mr6605983pzb.59.1708120401720; Fri, 16 Feb 2024 13:53:21 -0800 (PST) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e12-20020a65678c000000b005dca7d41860si475917pgr.418.2024.02.16.13.53.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:53:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69349-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=Gg9ReKux; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="zNK8/yhp"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-69349-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69349-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4C09EB2BB54 for ; Fri, 16 Feb 2024 21:14:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 136A8146010; Fri, 16 Feb 2024 21:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Gg9ReKux"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="zNK8/yhp" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F02331420A9 for ; Fri, 16 Feb 2024 21:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118025; cv=fail; b=riWhma3SOVwYbMpvrYRlMrlCXMWhION17iy3tLhlvNC64N6B2K9FiM1rZ/jnl7l0TLDOIMLFMcrDXHumrCbceBsq7Q5cLe8e7WHnQDMmplyHS9y7bdAVmoOorhvLAy/GTHVTlI2yc4U3xKOm0pD4+sk9wqYA9mhNPnTAQU7ul7M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118025; c=relaxed/simple; bh=KnICgGgh60C+MDR3o33DyZyreFrQKi4oXQqlTB7vAEw=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=LXqAODpxniceCu9yMA1UkDVlgJSHi1Hlxt/MqKF8QxGBp2/zdjNo3qQ2CT0MW8osBGHKp5I03XzBmoV+DjrU4puB31jzKA1uq5HOovofZGUfyawnJ0phLWmO48FE9Fi/EQOH0aqttsObt0tsh0qYs2hK4dUTf0iiFGdwfG252IE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Gg9ReKux; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=zNK8/yhp; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41GKEV77014766; Fri, 16 Feb 2024 21:13:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=C7E1LFEFqRFsFhXCtqRYBbiVglsmTcGDBOTo3k+XP0U=; b=Gg9ReKuxYdnZsJLCovFckR500BkxJSE8sZnqN6YOky4cMkb4JCkS/LymVcEDMELd/Kpz hHr7Yjf1nZK/6U4lJTtoDNlb4Dz+E7BXVgwe0Ajo0MKBJhizgaukW6QRzv3bbnGVequB CYTMRSa4ZFM06+9LGbISIamKLlQpP9w1ZgQvtFxRWPMceTk+PLHltymiuBYyE2q+lB55 5tDbLcy0GSGrUVb44KYgs8d3y0xIPPU2ZuEXwmJkXwRrbzVT5fzT7wYCWOipG9pCF92D cR6nhavasHe3sC9CNWT2Upmvemnk/7xcIp00K2VDms4FIM0K6MTUAveCBHMLf7dg2ZFg SA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w91w6xakb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:28 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41GKQueG015073; Fri, 16 Feb 2024 21:13:27 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykce4gk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KhBPmqbFb9pbUmynBEqMknviZc+4KXw1ri6IsmR7DGjQYkGx1LkNIlm2BPF3HzdLBGzdyzyBV2g2Om3fCFIsTBg6noUgtBAANhF5q+g8Hzl+K/lCpsJTCNLE2SYBsSOtcK18ZOQfJTh1iMJ+PNE9nMrqHu2jH7ir0XhxO6R04BJOtZtnXmFzdCpHuIgcar8pJushjjp/xkfIoKBBU+pJKvI0pshPpzQSH3cYlI4snN7pkU3ELKHPIXGldTAx9BUuGUpQINB7UWn8uk0dE9HCmH1PLwWT5A/F3baH4nHKqtj81pBosjF2KUpHXZnyqxLtrT8hQhCzCW4+3zIjOgQLeg== 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=C7E1LFEFqRFsFhXCtqRYBbiVglsmTcGDBOTo3k+XP0U=; b=RIN13BpZkqmdJQjpcav6L8CY/weKFF22/qFGnXoKs9wok9SjWu51I3wWvmCQQnntnzBegdAWdFUZFVgXgZ5seassrJKmfpEAeqdNfILkGpUEzji+X1skiTU5M86cDNsHVqnvb870cPxAWzk+Bxp0Y4QZOIsiassf1VFTxbFd3J2mFkCs5EY4A1aeeOxD6hoK8LQ89nR+jFI/YrwALRN13juuxnCIq+CAtlnu4ENy1WPhQgxlblZm13CtNqQdhx7hXFw/+uxBKWg2IrHJpuZhb2uzf2CEGgBHf/XFycnTk40Ewiu/Q7hJVgfjGpfKYdJ+LPA7ISDZQVF66pftALQXiw== 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=C7E1LFEFqRFsFhXCtqRYBbiVglsmTcGDBOTo3k+XP0U=; b=zNK8/yhpl8WbsB13LjnMESpnc1VlgTk023dGxIsQbjSpdizJ6Hun3OgiIv/JU/Q3zvMdydpVCKsEXhlCZkzO0LQjiuVqs/SIYXv9V4Gjo8qKj179rZm1DEBzuaBoSyGQFN245rn1rTKXeGOwdmy6cXBbEWSZJ2sD7n3za+a2myI= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS7PR10MB4909.namprd10.prod.outlook.com (2603:10b6:5:3b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Fri, 16 Feb 2024 21:13:26 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14%3]) with mapi id 15.20.7292.029; Fri, 16 Feb 2024 21:13:25 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, apopple@nvidia.com, Sidhartha Kumar Subject: [PATCH v2 1/6] mm/migrate: introduce migrate_pfn_to_folio() Date: Fri, 16 Feb 2024 13:13:15 -0800 Message-ID: <20240216211320.222431-1-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.42.0 X-ClientProxiedBy: BLAPR03CA0150.namprd03.prod.outlook.com (2603:10b6:208:32e::35) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS7PR10MB4909:EE_ X-MS-Office365-Filtering-Correlation-Id: ef414004-76fd-4796-fa39-08dc2f341d64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N9KjnPrEjQhizHTSf16oCiJNXzX9WfmHScdtzKJLPwJHJj0gWhz6RlV+k1+gFnvcgtthmcOW0yZRsasZNQOb6upo5Kq4OBR9tUdJ7kbSZ3YCdHyCQesLpiDbzAmLRCpel+eSzDUsxTmEu7T7HyBQ1FPPtiJ6ihJUWxggntu/7xRa2t2gy/RNrDKLF7dASyjM0Jc+RbeXQMXbZRQWHZS+SGsW4fw+0XSvC3YvIqPA/CQDNU9BBOCukziKOOgzh+fgSujTsQOWxNlq88cD8PbV74Ud5/sBDzRo3UIARl/TkUTihRFDO+lP9u8/khhai6ITvm0VrgvIA3c7hdHaW3cxxc+8+zzOg+H7NLa/JzfmVPIqGJypwrxeZHs4HmYj181qy0RWCDGsulVuJ+bASna4WYNqyTBhW10PPwazmgfPs4mxwLBGHf5kcdloKRrJSFy/ZBAshscbZhREqNpAudqxH7k1y0Mu+ZKrUAvHByFh0uS9tRvEsft85Y4dFXrfYRDqwCoH/b2r5K9hwjrJs0JK+GYGxFkhdrb6uuswXDC9mRZLPybTQddB8YtWhytKGe7J 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:(13230031)(346002)(39860400002)(136003)(396003)(376002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(86362001)(36756003)(38100700002)(6486002)(41300700001)(6506007)(316002)(6666004)(478600001)(6512007)(2616005)(107886003)(1076003)(4326008)(5660300002)(8676002)(8936002)(4744005)(2906002)(66476007)(66946007)(44832011)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yyQRW4+qY55BFFmk4+/Fj/vbJ+YQpKymLdLmICXi42QbMDH2c0siJRYnYw/H8X2NOCv0h/Em5SpJ7ysKAqMYZh1eUaK/wgPKeP43xcVjdgjCvwxDEkNTngFZmezel1rIY/9bhNzQWM/d85mKbiRwfgVBUc3ZNmJGBryTnzhvjpbhgs4ou4C/4H4YGqjslT/szi14v5YYTtK0vGQQjKyAint2+/tR+yop4PHHkSdigMyLungtVAgaqh+MkV608Zo7cjQu2YLhQ53FuSdqw79BA37ZfgJicySmGq3uT71+rDD0KXX96l/4nGEjrNHCRLtvfl9WfXq5K8ZUDDmEGcbmvvty6PjnSBZ3yI3ZzxLlD7gVUvHKjGcNrb55nmZ0NafYNrTrD2p9SOc954K3ppCHILpmtmcZfxyjCRc0nhD0CnFsaggjaKdJcVlwuMTZy77m9B15/NC0GHls9z50U95aBJz9eP5BsWKM6LmZLS9r4B8KqHjb/vY/oCosXd/9SaOHiKS1qaC1HP5+grCV2JO5N4RcfbKgbUue6D3KJTaZzOLqP/iFG7dZsdOgzF68BQKoP9W5qLTOOPHZuYjq2ePBKR0JZ3jFV417HyrajB8pBLFrjnTW70BdUj2kWMUT1bSR8ubYFRnu+pItDomv0WGfhEKStBKZk6cSKrjd9EbnJAuFU3Fg0bmTkB7ae7AACTTqAKM71ZYuBAjIz2lZcQ7RsesUjEpxmHk43XMsSPp8JHSjurmtCwJI1UZSvQESgToIyrtTrFfqHkqmPNWDCpmyyLWFpN9HdaQFDTrj0xjc4grjlD5SWdHCdO9t5zVQqRcrxmyH/dJ1u0ZwI32MPEx3nPTN0DQ8oCAdvQgZQUnFDTLawBnGFVsvGrskA97U6noA3IxT91T1I7fLQFSQkNWkNnXYAZIhdEEbreLGvthukcWfuNjcmSyqcATbFELUAljyWxqR+HUGrBxUmMUDFSxnAP9UL1Nuk+khkB/bhxGRx8sp6hKFZ2/VqqF1vXgSSHHv8C3YdyF3CaniD2fcuo9V8safhaJ8Fx/B2wHi+8xQaTcIDuqowsgFB0a1ZLv4RVWZY5DFKbPICYISMH1uealKnGWJVKbMC/13e+US+AcdDmP4/KstI7Zl/ASS40W3EUjHOOjc5xls//h6/Y1mP9bfYN664wBOiAdTCnMtl/go+/MtF7suN50dN0YQkhhyPczo9ty/Df5233ObGHC0FkXSpzKxRXIQ9PPoSdGEtRdVMV+zPXKrwf8sTqbX7RK7tnJSjH9lbDhKa96tuqZGrqWgeV/UMiGfsQ7uiMzQQcOceQGCqW19WMHSpZ4X6KGBH5JU1x+FIm8ThY7eKFNQD+3bWp6dKJvBcen/WrG04s6Hgvs6BmAZV1cqVhKy3ADKklYb21J6siL6osecSI5k2AOhLyzvTZUupc2Dhmq0bcRx52VudvavLdCF+a6KHREW+cPYCvd0tLK8ull3RxcjUxSp/femU+aBeEm/BrKpvcAsB68B7NqT6B6m7E8ul0VQJLIpBwJA3LX844OtRnBm/17jjpnlM+51V3tDb7OUQfRuW4Muwo6xb+9kNqxp6U1u9/8VEeI8Dpq6AevtiwupUTdKBCo7+z7Vz/l53vi9UksRFPQ= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2+JaVPro+ERTv336M6pxf9ecIEqjeq9g586IK9h96zBAKVZ9sJNDlW9NSqZ4hlF+BDw5VujxYlWuWexEeLmUzqqd67x6tnLVcyoJybDtuDfE6omTFNxWSIvX/dG7SZBQ8rQXLKsVMNa2iDCB5FUhAipa5eym4VtGHsesZIxpJrd0dCygY3aX5NdiwM14pVk9wlKmEzq1W0o2loOjo0gzugRl0ZpD19OgzTAd2+03jF+QjkpiduStw3WuEVSS6DImGcz+ICP0v5aoYZsNLdmIk5ZLfOeoEsh/Hg8bhkwpE899sVV1bcu0bPzw91w2YbBIAebgtojku2yhMKykyk1vPjgGWcZxCoKbY31c6hRUcYPp/Ewigm9biiluNKwqU3uQijo3+6ivywzGmod/HPQXHNiG38nLb4Ys/x40meye9FDY8GjvSk1yMGL5mdc/69ZM2K0/1K3CgsS9slVNkc53laVf5kJdiUTxoE8kalo6nMrNfAj+vAo89p/tON3FdM85lIorZ2SSLoCseft3EJ4ugIyEPK9qrxpWL/NdMcMKJ30RKBEQ54/J61EA+5f9Y7uIUYwFvH06pRK3YwOuFm7jN/uG1YHSP23+scnpVYr9XbI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef414004-76fd-4796-fa39-08dc2f341d64 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 21:13:25.8969 (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: iIbIZ33os2BlNkr5raEsKKDlFslu0k3/4Wv7jDs2+6sVaqJmSZ8PytEasRfKfiHpFHr9Av1DJoZiJ0u3U9DKudoQNvFm5Vh+xTOJKn7tIfE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_20,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160167 X-Proofpoint-ORIG-GUID: qgc8GBs-fDdfyB1N6LjrkrIiPkCHMymW X-Proofpoint-GUID: qgc8GBs-fDdfyB1N6LjrkrIiPkCHMymW X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791094058091571180 X-GMAIL-MSGID: 1791094058091571180 Add a folio compatible wrapper for migrate_pfn_to_page() so we can return a folio directly. Signed-off-by: Sidhartha Kumar Suggested-by: Alistair Popple --- include/linux/migrate.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 2ce13e8a309bd..21a1a5e415338 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -171,6 +171,11 @@ static inline struct page *migrate_pfn_to_page(unsigned long mpfn) return pfn_to_page(mpfn >> MIGRATE_PFN_SHIFT); } +static inline struct folio *migrate_pfn_to_folio(unsigned long mpfn) +{ + return page_folio(migrate_pfn_to_page(mpfn)); +} + static inline unsigned long migrate_pfn(unsigned long pfn) { return (pfn << MIGRATE_PFN_SHIFT) | MIGRATE_PFN_VALID; From patchwork Fri Feb 16 21:13:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 202379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp11925dyc; Fri, 16 Feb 2024 13:55:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWXNj+tD5C9FqHgJ5VE2LZAyW1rB2NDBEB3FkLML0UHHHz/s4r8BUrsN18YLGUhjmNK7u1/CR9YYq5LO7JJ2nl+uirfsw== X-Google-Smtp-Source: AGHT+IHS6xritChJpVeO6rMj1y7WUyNCAcp7xOOd6FdUmaqSOaB5fHCCcBSUTe1sseDuMw+/InY8 X-Received: by 2002:a05:6a00:3cce:b0:6e0:e83f:22b2 with SMTP id ln14-20020a056a003cce00b006e0e83f22b2mr13338238pfb.6.1708120556986; Fri, 16 Feb 2024 13:55:56 -0800 (PST) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 199-20020a6301d0000000b005d747b7058fsi460085pgb.778.2024.02.16.13.55.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:55:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69350-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=YEX+IVx0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zRE5wfUm; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-69350-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69350-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 27C52B2BC6F for ; Fri, 16 Feb 2024 21:14:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AEAE1474A7; Fri, 16 Feb 2024 21:13:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="YEX+IVx0"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="zRE5wfUm" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE4651420A8 for ; Fri, 16 Feb 2024 21:13:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118026; cv=fail; b=MjEcxP0R2lsWmX5RDZJjM/BdD/KMC6PeOeA2jNK1NDr2N4ChZtVjWwi6PBn3y8l8uyTa8hCtr+r9i4YNPUm+IgM88rapWZpSTMm53O+40ZXQ0LuarG9F411v7guIS9Gstlq4uo89ldj9x2agLj4uPNyrdP6KLtC4mYa9f3K8KBU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118026; c=relaxed/simple; bh=gqcZPWdeNoJUlXxETU7NgIy6TtQSYqYv0DWC02GcgQ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=p7ifQ6QUWxuWi1od43hWCIx2b7fSu944Z7smDGG1839d+b7n9FECSu2QBtG282jsDma7EerMjc2RY3u4Bc/sTQB1fXY1NGeKfPnKuBlhF9u9VYCTKCq2GwGRvwaacpoifJpEbpYBtOc+/WUo1KbtG2Ynw3EKjgOPH8eopKCv/zM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=YEX+IVx0; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=zRE5wfUm; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41GKEgsQ014845; Fri, 16 Feb 2024 21:13:31 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-2023-11-20; bh=6cEEqxrWSmhx+Ys7t65MJe6QuqR9ifBsjb7IcYbYUQY=; b=YEX+IVx0JKa3JLrU/q26C4pR/4CipUNT1IYt3MdAUY0n7CEry55RwydS5zHjE3BNta45 Wi9/NLNnaaMNgLFTlbXWn42ktO/w9yS7sQUmtdkMjxig8BIwd50ZubFz2367BzC2us7S jxVp3bTeWT8C5tGG3ZnCaBsn2aUAcrNPLvb9Cd4xHT+K8M9RkQdvOYit8mfx3hmlYZCK gfZw1edJZzyOKYqgiqGubwRweZLiqpy9lu2TglbKHz1zxrsk3uJ9OAa4jjO9k/+JY0eT zLLi0Mk0LWkGffBwimGcRAIOSi+bIkZfuoIuYkvbfQWdbDpoIGafr6O6HBZB19KopCKP 7w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w91w6xake-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:30 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41GJjfZw014975; Fri, 16 Feb 2024 21:13:30 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykce4hx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBjP1zo0tBBCizdL1tzZ8Kf74YIrxBHHNUsGzW3y0ZqTyNFKAF6CKAAKVPWWzwan0WAZdQrT3wz2joam1PfjTLc/WYoNwZ6lbAl1KqpbSJ09LJWoaU3oqEpiuT58w3a8JYreq4p7SSI4VKp9IylHPFybSrGEA5iRq6M5Dx79jOGhT+CSizCmukQYH23KqiCXMuh+JR0QX7A7WxNvVUtuKIxOuD4FXBPLJ2GYJz6xD16GTNu+JjdQyUlf6NJAsOSaHbFBz65B/S/uGqHNUpDCCpnquhdbjCW8p3BI8ISX0r3efUvPzN/ZagwXH0G7GJgWN71CAmc5raDT/5D7ExvizA== 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=6cEEqxrWSmhx+Ys7t65MJe6QuqR9ifBsjb7IcYbYUQY=; b=U8muZ8gCzs9FjFm4gkOKweuw8Ig+In7Ts7YNrBIAzGwdRIy9fNr65K2Nj6tuSYYxXI1vovys3CR8vh6rBlATiPEHXpa0dS2S6emiLA3BV3yVGvIUtVu63vw0yIyE6j3a5vu13DCP8b6t6XxsdgShDzHGHNwvE6z7nL/bMgiczFvXIeg5rbrYvk+iVwlbEx0wg4IdxVGZ6NfqD8FMfGkGirImcqsUt0pUGf22jHwZVrPWPNtHLMFeLizVUesDeF0L1L634FQrtkq/SQ24wWa4FOrhkPbwuVOZFEPIAiQ0+jEfvHwDmNg2IwcAT5xQpolc7NVswXgeCO71JqzhdCKsow== 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=6cEEqxrWSmhx+Ys7t65MJe6QuqR9ifBsjb7IcYbYUQY=; b=zRE5wfUmzgvXJ7Ud9Qnztxgz6+4TPRJ5Uluku5g7A3IXUWsuIpH6yKDOW3dBLGuDUrcp69Yce88NMLBAgGrSTDJNAbNxq9YFDxySzlN53HwkoDaD+NRcJxibq2jdAiIFQrhHv4a7yHlOwmTUAPumgL0+wQv7t+bhtzIjwXOH9vw= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS7PR10MB4909.namprd10.prod.outlook.com (2603:10b6:5:3b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Fri, 16 Feb 2024 21:13:28 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14%3]) with mapi id 15.20.7292.029; Fri, 16 Feb 2024 21:13:28 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, apopple@nvidia.com, Sidhartha Kumar Subject: [PATCH v2 2/6] mm/migrate_device: further convert migrate_device_unmap() to folios Date: Fri, 16 Feb 2024 13:13:16 -0800 Message-ID: <20240216211320.222431-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240216211320.222431-1-sidhartha.kumar@oracle.com> References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BLAPR03CA0142.namprd03.prod.outlook.com (2603:10b6:208:32e::27) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS7PR10MB4909:EE_ X-MS-Office365-Filtering-Correlation-Id: 22e8a00f-bf88-41e7-8484-08dc2f341ee0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YW0I6y+sJio5y+Uf+9yZDUd/GMmIvrn6gwSErceaCgvKN0HPLINp8I5vBsr75+VF1Kb1xXTpjerdd4vl40qDvXGoB3YFgQ/zi3RmhVTLxK8sX6nI2+HTM2K6Q6ceG5hhtQbaW1ppdy//k734Xy6iHY1ZJYvoJWR3P8pB8fmm6S9ioZ4U3UxRgv5tU4EXFUskuKaB1XNl0jLye0WIjhzzDckoZHtuqYl5ShMtkDmOZwzplHuSuVx7GqwnQjNIMTYuHCr0gIBuGGV0AuysNwOaQ4mvILaPZkgt1x7PWyqj7gOLoo9Q8Oho1rQ8cepDug7FnXNmgp/PupMYCjmfH5Y9Wo06+kXyX7BeEittvE3IBorkNUS0P/p0GF5MXnZDgKhwXjlqXao9XyPQrDY4vLmtOPc8LAMSOkm4EynDq1wuQ9+TotUHReh2yskxDo289XP+pq8l024iw7IEEVV+fANQjk+HJRGd1I6e5YbWdg6oXHAaSYFZODnsIvHRet3hO4xVqcT8MWyB9otp7kHT9nbN9J7CrAFR6eRx36PQIzYjKl0tFqksR02IHh8b51ckU9K+ 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:(13230031)(346002)(39860400002)(136003)(396003)(376002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(86362001)(36756003)(38100700002)(6486002)(41300700001)(6506007)(316002)(6666004)(478600001)(6512007)(83380400001)(2616005)(107886003)(1076003)(4326008)(5660300002)(8676002)(8936002)(2906002)(66476007)(66946007)(44832011)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uZb3ErOosHeyKaoA1fnoy96K0nGBVWBVN/QDKNvz1XTTS+P8u8urcut8j3l1Ul8gIGVFiqcO+Vloww9iFyP4qm4G/ZWM+lNsNMZbK+vATPW3pgcn9EaM7V0+TQhlOtEo1LhMdn9qkPLYLCToq+DLlXX26jH4pDffIflLYkDwSvfrM1hJvCE4XOz7pMy4M/+S+gb7yYRIYg/7BPZOeUK4ikWu/qQ3cF8McLMPptAX2RGX7bEeRulBGk2dXn/ZeTvTV149vyDS7XUtzeqcfwNPQ7Wf/OZBShvPCeAo7E0KMP9urForvFtWYceRexh1ExgcoF9nuLvONPnm+94mSqRLvPVgzc9THKHzEHTMCjqRtr2cBEwZ2FUcs3SS9ej4W5VZA45nSEojiOEggBgf82Bm7u1HF5HVTuluGxBR+ytOvxBNuIz/efjZCy2nEtE0uLQ0yVCFZ/aLJM944t5Bnh8rV5KcpYFXmtTZYBuIe+qOj0ek7kTHnjbcVue1FQXrJcenVpB1qAu4ZMsOh7qJlQH9SHFqISzytklbtZJSEYDWghu65ar+tuBJiXZUO8ZthAaWcUb+vE2cSEMCLWFefflg84N9xasE+YwsGMm9zecyu12tqM1OPbZl7uAMTmwhwbWStSlVQVP9edBouhjnkTnZYXg3Wo5SccizKf6nxXc6EJX9rg9tRI7k5rKVj7MEIgE5MNR6xscjlbl0noMQK/+k7Vpb5EBmX1SbaobFcvB5jL/25++Z+iwSJtgH/tjNyPr53UJv5jkGwib1LKbaCfIhCExwLKnDInKDJiSIQR6c2gOfj4jVbYLWLWjNw4aqW+D1ME89frs9gm/Iq40PQrdTzRJTBs0DI00VGHSNukG/IMofwUAA6bjO7pjLgYuhfabNltOg8IG9xdv4teNiaVOc1kufnd6EFGFN8DnK5XtVEck254TpIvO2VcRHYjbTrdogiBA3FCWFNd1jJcTJBo/PfA5AH8ESCXl4QPGzl2A43ynZtk0M8bX0k5KAuLybDNM9Kia3H0UgVG1Os8WlTT7xWl9eIWRGuxxRt5EC5q38rsNCuJAaAFNtxENj3248QKnZzojV4OxdpobVye/yNdVs/JHm+fDoqDzUTSXw4YXFk0RDO/Y+zaa2siOdWFjANxBi4Tpgnl+VvfBKJR1/UzVE9r/YD0RfjDtXHdm9YVtSppJ8s0ais+p7wwkr6iBN6mhIkkgvXmTo6AMTNrHOAwLd3iZOIHbB5mqb4/gH9DhKTbQ/yOP0Sfo+PfHZzy34aUXuwuo7Ie6Ge/COBiA95Tpsr2JrVE9ldqxIy+PCmQziGOFoy3GFL/z2QF+HIB7gppg8R9VUaHDQMEhXixRxPrDjizjDtv7JoBzAmBByzMdaNVrl5ZJUDGgMKc7Gu3U9Is6CFzV07cseYVqKkXsRD171TcOB08zH0NgZUlBb2LpuylZffZv3QF4sner+MwZkWq/6wXZ1Pxkjen/E0ekt6vUeSKP0qHS0hpja7jDKB7xGkYGRadTlErd7gP4jViQpffslUXJ2JiHrlvv0eMxUDrMslMgVhaY37hionrpxsaBY/26WsmComfeki5f7ZaKL+2R9rcRCm+lPVbkrxrWwRohZYZF6gJn3WxWTc8fU9gfxsCU= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: pDqU/c5lVdn2I+xdaMHbgYw8WsunWlD6o5Z1GGlcFXLpv3UUpuB0bupESKmFrbdlpJYac5or+gLmknb3nahZkgK3ocLy+XzZHSNf68oKQ9MYh34PZklDYaMtSmjCyYYI2cFwHIEuDTYnQ7zlt8gg8naU0/2uN1ARQux3F9g/Gv/PR4MPDH/jyKdQUW0KWaUdhi+Q4FCH39DOWbF0h3GZ71UcCK4o80eDRkt3IiKLt9/D87Gke75g3wU/F2XVfJlN7mFqkZDSqzc6itLyY7mp5PK1zFq5rflsytjUVK6EpYYOHWO/v2H45rC8tkCaFQyXAuVIJCmarg7LqYyTav4ZZCgFuxRhIDs9CkDMotVd9S6WzPRH+rdvCJ//nDYSwzWJct72oOt1ybsWT5BINxzAi3P4mdW/VVO8PCl8cWFmpVkfIGesEG/0kmDByP8nmOj/W/CmVYDLHcCVALKdQrhTG+ZZedw2/Zx4AlHIoDxcrRz25L3K7lPPr+/7n8oUvTveJeMfV54JyG0Mj851xhJCf0G+eq4K8FEuUy7E29486h7yTbBh0oOuD3zbFxM4RKxQscfHhwniQkmbgsArS25TuHsZhej0BfqPB1eu4rtKD9U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22e8a00f-bf88-41e7-8484-08dc2f341ee0 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 21:13:28.3658 (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: W4JTuKgdo+O5tC4KKQtCNUZB3THPEtrnxr6jjqR4UmI46Xk3j290PD/BycXlOCFwN+063NA9NF596qnyXzprHEyo7G0ELg2K2+erEUP+m2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_20,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160167 X-Proofpoint-ORIG-GUID: sdGNAVO7ACbEAUPePqT7F2PxhQhAOW7t X-Proofpoint-GUID: sdGNAVO7ACbEAUPePqT7F2PxhQhAOW7t X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791094220845952813 X-GMAIL-MSGID: 1791094220845952813 migrate_device_unmap() already has a folio, we can use the folio versions of is_zone_device_page() and putback_lru_page. Signed-off-by: Sidhartha Kumar --- v1 -> v2: use migrate_pfn_to_folio() to directly work with a folio per Alistair Popple. mm/migrate_device.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index b6c27c76e1a0b..3d3c2593b5b64 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -368,42 +368,40 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns, lru_add_drain(); for (i = 0; i < npages; i++) { - struct page *page = migrate_pfn_to_page(src_pfns[i]); - struct folio *folio; + struct folio *folio = migrate_pfn_to_folio(src_pfns[i]); - if (!page) { + if (!folio) { if (src_pfns[i] & MIGRATE_PFN_MIGRATE) unmapped++; continue; } /* ZONE_DEVICE pages are not on LRU */ - if (!is_zone_device_page(page)) { - if (!PageLRU(page) && allow_drain) { + if (!folio_is_zone_device(folio)) { + if (!folio_test_lru(folio) && allow_drain) { /* Drain CPU's lru cache */ lru_add_drain_all(); allow_drain = false; } - if (!isolate_lru_page(page)) { + if (!folio_isolate_lru(folio)) { src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; restore++; continue; } /* Drop the reference we took in collect */ - put_page(page); + folio_put(folio); } - folio = page_folio(page); if (folio_mapped(folio)) try_to_migrate(folio, 0); - if (page_mapped(page) || - !migrate_vma_check_page(page, fault_page)) { - if (!is_zone_device_page(page)) { - get_page(page); - putback_lru_page(page); + if (folio_mapped(folio) || + !migrate_vma_check_page(&folio->page, fault_page)) { + if (!folio_is_zone_device(folio)) { + folio_get(folio); + folio_putback_lru(folio); } src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; @@ -415,13 +413,11 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns, } for (i = 0; i < npages && restore; i++) { - struct page *page = migrate_pfn_to_page(src_pfns[i]); - struct folio *folio; + struct folio *folio = migrate_pfn_to_folio(src_pfns[i]); - if (!page || (src_pfns[i] & MIGRATE_PFN_MIGRATE)) + if (!folio || (src_pfns[i] & MIGRATE_PFN_MIGRATE)) continue; - folio = page_folio(page); remove_migration_ptes(folio, folio, false); src_pfns[i] = 0; From patchwork Fri Feb 16 21:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 202369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp792371dyb; Fri, 16 Feb 2024 13:19:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX078SotpvSihuCwPU9G1Eu2zr0NUOHv8NmV0N+cJhPoR0lTb3EtoeUwWyPG14YjvuSirFe5nEKbG/EwtlUTcBXx7GB7g== X-Google-Smtp-Source: AGHT+IGxTuyNe+WvBqzqt9YAmtEKPuni/yh3NGlfoWkBYU5fd8KkwWjchPDqdmU7YPpzmuNt7KdB X-Received: by 2002:a17:903:244f:b0:1d9:650a:92e3 with SMTP id l15-20020a170903244f00b001d9650a92e3mr7257694pls.22.1708118395997; Fri, 16 Feb 2024 13:19:55 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lw5-20020a17090b180500b0029701ed7d80si530888pjb.115.2024.02.16.13.19.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69351-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=aHDUZdnZ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZSt1CDOS; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-69351-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69351-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9D50028247D for ; Fri, 16 Feb 2024 21:14:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 425CD1487C0; Fri, 16 Feb 2024 21:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="aHDUZdnZ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ZSt1CDOS" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCE3F145FF7 for ; Fri, 16 Feb 2024 21:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118029; cv=fail; b=gZxz7mua90ED6Biki6BOZJLZXcYnxkPqIgcozSL3Mhel5SH33kStQK82pc495NRhVKIIjmY9ch61tQ+q6f7RwJTHOF9PkcvNnTDDnsHKfjRxpLXm/3NDpUIRo/kBaof6/1+oJ3azEygUPmCKJYEriwmR9i37uIX2+UDK2yr5xlg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118029; c=relaxed/simple; bh=OrX6hVpTArQgUvHv6Df6+VWGIMQBMKZ+dkyXYEpdjuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=HBUikbdVcbApN9I7chVr1TyHcMgDG2fRzwSTZZmEjRsJl5W+pgaPsDLa8de84w/0+bdw2iW809NYcTh00AoyiTdWT3T/tnDHDLrI5gQAHxHso+i4aWz5P8Q1DtQh7z4OrPTee/QQkINlxDjZDyAULNjf4WaTv75KpUsDYN9ziJE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=aHDUZdnZ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ZSt1CDOS; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com 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 41GKDkHZ012166; Fri, 16 Feb 2024 21:13:38 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-2023-11-20; bh=7PLIpgoX0WzBhOeTtr7m+MCiuzEgYeEYqWfbsIroNjY=; b=aHDUZdnZJobBzPh1V7T7n+AFkBLm8+vcZLqn2LaeSGekY+I730fw6PzkpzcqlGuOqd3A ITq1+0nSRqgxttuaSwrhK1EXnRlQuE9OjOCdS4HTCt73qtD2qpTx2wWnKG7YK9JA4f8R av8Zxdhp7nrYNOyA6oVopm4HEEIil4vqZZcAM7zA5pIpHKvAynOllBPyg2eWHBx7pvj6 qKvsYMwnxIu/awBMVKzug+KJeHmrKEju68H92L61wMcLGs1xTi3Xl+PhfhMjUGWInSIH 1BqG38aRQPNxrZ5jSQdOcfWtMWIOrPr10LecCrhzsBkACMbdrE869mmV5YxwdYErO9At LA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w9301p5vk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:38 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41GL4CMN024548; Fri, 16 Feb 2024 21:13:37 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykk0v8y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W10E5q2m3YYR595P0iegIR45JHabk1MMGhb+rX9MXLRIEm0CkwRAe38dwm2dkua9ZWhcM2tyBoKRblSwDDbArZiYfivo0l20moSI16FIOm/JZcTW+vgpKXRq89sx7PG420E0YjLGlcM0M1T1F2au9xFP9Jgwn81ftGoYe2WoMhmuM36chDSCtPLkIDaya84OiIzNEHywQRqXRHtBQjcflwbelRSEaTfB5d8zD5u2AFXSWBSnEjVe0RnTFkdp2IXNgknQHyHXWuO1F4tZ9TrpLYheYOSKQxGwIXFV06jYJmulB7HDqX5BLW/zCEw/x05hzuBB+sjAPjmHUV1CcZILTQ== 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=7PLIpgoX0WzBhOeTtr7m+MCiuzEgYeEYqWfbsIroNjY=; b=EQuurVbkCsfz/ZBMdvuH773gMWSWT2sIeMp6fmPIZXuGC1Q3hwBddNhgX8cO3WLjJNB8hHaJvHOLtIU3BzCfQ22LF2HhB7lNv1rUkIZD3hgbeKjMOQYvKsjWIVMI9znaf9G93LuxFrBrysslHD5qlxp4GcIklp/JD7K7jZynE4AVZxXJIQadvJBiBKmIOAWAKuoh7IBPBNpEJv4XnZg8SFy0Z4kFILU75Yz612qWN1vGeIJC9+fG40X2lwUYjC08qxxNoS5YrNKB4qrGaIpuKxOtUT+Oe3/Jvq87ow87RbZfJhupfe7wKJE69tMiY5FM1trIE+cyLQYKb6xQr1Oygw== 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=7PLIpgoX0WzBhOeTtr7m+MCiuzEgYeEYqWfbsIroNjY=; b=ZSt1CDOS5DVIRY9LLUz/G2eBEE/31HceQ8D68azkS3PXMmcBJ7vqM/INIuBX8givUAFGz56IezRII56X6XF56+UdhYHQsRgL9t2XK0GZ9U29X70A8DxDHjJfZ2yKyWRUm2SNKqh7vJcTkXwAHl5kWpLNHLWJhV+SpacxzH6h3m4= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS7PR10MB4909.namprd10.prod.outlook.com (2603:10b6:5:3b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Fri, 16 Feb 2024 21:13:31 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14%3]) with mapi id 15.20.7292.029; Fri, 16 Feb 2024 21:13:31 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, apopple@nvidia.com, Sidhartha Kumar Subject: [PATCH v2 3/6] mm/migrate_device: further convert migrate_device_finalize() to folios Date: Fri, 16 Feb 2024 13:13:17 -0800 Message-ID: <20240216211320.222431-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240216211320.222431-1-sidhartha.kumar@oracle.com> References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BLAPR03CA0002.namprd03.prod.outlook.com (2603:10b6:208:32b::7) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS7PR10MB4909:EE_ X-MS-Office365-Filtering-Correlation-Id: dbcebfd6-7eaa-4fbd-b4e2-08dc2f342077 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lfqLIFDNVPj+uzcbTmB2YAVc9oK9qNIGME0HSGInSSogPKauTFxpUDSAghbPzOXkR04FAtzDGCLI2zi0xU9PPIWYTHdfZL5FgqC2CJKNNyZtRuSBtY/O8RT5HIUknp6Vq55rkAvNh4MVebpGbcojYwoyXfcpMrjNOBD4hibNc43AzTKNJXlc2t+hPWhKZBv60R3mkdr1CKuWS6sTfKW6vOMXJhAKDEOED9Rs1eGK9a/DAq25ZrmHbz0u6F7VjVGeRe+4ndX0jweRmIL/U04uMJ+b+el7R/fZD9po1M0YzkN1RJTOQkvrp9pljrfAr3Ul+LnRVME9OZRuPjusccUnSnHDF2/pXEutF+vAOIiNOuf4PVilP13CzfUmw8TVxOOpA8zYerFgBBy/S1Gqym54QRqwIVJ+cWY90U/f5bRdMSZcein9x3rY9emhF4QChzigvuz4TWzP1ii8VedmtmJvKwVP2ihobWlcLlbpMclfg4V28Dxs4En2NV/XxKZq+dvfeZZcIaQp1q6hn77Bw+8Hc1VMvHQvioM11gC5ytjcb3qVkmFtuBvFlXLTrC5IHayc 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:(13230031)(346002)(39860400002)(136003)(396003)(376002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(86362001)(36756003)(38100700002)(6486002)(41300700001)(6506007)(316002)(6666004)(478600001)(6512007)(83380400001)(2616005)(107886003)(1076003)(4326008)(5660300002)(8676002)(8936002)(2906002)(66476007)(66946007)(44832011)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FfnJ180e9hl9+U5Nniqp9BQUXr7/vo0H0b79EnaNTvdM52S6UVpXYPX7gHs28Vi8HpkPPOPHuPHaM/Qz3DMtSblnB+qpORhUM40xZuvkiwZKDOZOk/rFbQuCkKn4CdszU9sJ7yb2vLbM2ao92ib2HquQlgTCau/PG8kBsf1qR6iMjEsc818gF4grIQaMLo4qrHv517fqgQVYnN3GfFIFx+UfsgxEJ+LSYArRv9G3+uS3vq47N7pZdFqugbP+J2ND4dRCWIaOyKId89zJFpqMQZSjWzN4Nr5EvMMBm2Vdcsj12vhfkC7Vki8hh9unbA9/CAGUYAmmC7Tdd+i+GVm67cge4AcPJMLAmNHLrpOj7sPQgvYPx2JkRRUcZA5oS+Vn2qA8oBLjex1EE5vWxI5vwx3v+9r1Xh4a34z6TfWssOoAQThTM5BK2en/r2mBQDeLPSsEl90oLNxOnPYxFcQ7htPn4Om5iY/Cw7LAlm9xAjP960DaSscdLgPoom/d9QKocBvxIrrrJqYOrKAIhhEwYsRveEQJ9v+AxId4psAGMMOgWCnGyk7em/kMbmepqWZiQrLCrw7I1Ln90euZMFIyY0+eyVHm8xhXICmundL8A1gR6w9vCRDR/R1oi/xbsv8tS7AUvvtK+NnjowWnlpnCiKtErG/9S44XUZ0V0abY5kGhgjYLCtf5OGPykKxMTANo7TOxjNMA42XjdPBriCU0neX0Xn/+R7o27Riz3sQNjW2Rb0M0z/7BIME90gsqVhcPm8LAF7LPShflMLFMkvDTYusEpFU4SDnSC1AzeT/wh1kEduGnp9N7hEt/4i1wC7KP6Wu471UgoSsWhKqU7v2+235woz4YB/Z8ru5B59Olpwndbi54p77BPtuS+/PqKZcBy0IaQYFOrZfe0DKn6LBfXsl3GmUahF2WacnCN9mdrhoCFKMV/BznEOIPABqFJvtQyXKKKPaCFytBScplODbqXmm7GyCa1vcmq4YNAWVmuMWVi6JK2M09gJaRd6ByNkw12hHT+qkTqEmxilnKEj2LuE97WMWXYDG1bg/F2YMq/oeTqPVo87YEiH/xo3N/GrqaqJHw9pIuINZJO2eK1FzybHpXIQu7e+08vcWe1UUxI2WAod9lJOTDP9mvyo0s4L+5VmOEvBdco34sJIoZBVSAcPX8hFHiw/je/Q391eG/l/l79QShuT9pE9yM/tntX05FBddBTbuJvSFKXuJ+pialtAb29iGMzQGvyzGefhREdbGYWZr/F/05O/PS8lstej1cb7E1oENUmP8fBW5RzeBg0nCrEvdUir9sNe+mVR0Kb/WcKJi73hbZ8KF3y/m3nUpyJ09tK8XGEUnDPgPRzgrndud4w7n0pDh6sur5hY9mqSU2VnoeWTrLKZGgGNnkwP268oxRWiFdflC3b2GTusH2eXLNznCrkCbz16aYfEBeriQIoQKwWkhpY0WMJvOi9/9EGYQTrlcgnfYFxcNiIJfXAqbQGwgZrw6ARNMHYyMt0G7z6QMqbzYikYFrAQ7TLzil0EON+qQqVnYdzFkbz1WYUBRzAXCY4HGrb/Iby+YCqEBfvMxHD6Z6DdrxjWCSw/9c3Hyh2N3rrO382u7kPxlZ7q37GzN+q9YReEfIwKCkWPQ= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ySCrPWNqdKv4yuYPD2j+K0DXBCHwFA/b2GrwnQX+cjyRl0uJD7YQ4is+rE8Rra/0RtUHdJiVxCSNn4mmfAxXiIZPkDVMnA+Fn8WcSrglbiggYti3w2LWEfzGmwpvSTD92wxJJKOfdWX1Fh9KpEwqH5uofYmmXNyT2ZPo4aS+MjtGnN84yv6Efmes66nvbXXnhTLBxIqHFvNLjCreDLqijSaGu2UZjgRLqFfTHZm4DqhNcfkD592MofRBJALGkWuHIFhHK9k0I31q1h71TkXiK/aaY0KdIwIFFzQY9V2MagZDxeG86cwer7kCndBZ+doqC/sKj2pJrwvmUOHpWfaygTrtztHllZxEMsffDqBXnEuQ3At7/N3hAL3+qqW4DEFGoIeFfPEAwZO8PKoaFbvT0NBjm/6kvJLCs3PbtcxO2Egi+KxGGh5eQ8NO+FuVckwPOzXZdRfi6cqOMk3zJEFy3UKCjGLHOV4ApmcErjX6bAMjScFDTJIVCmumpgJqjIa2SDvOYX9zWmFTkHQiNqOgC3fPxY0a2ipafrkVjNwgDafCsW1fq/emSFpgVgMTZYUs3Hk79owFdQR5P7dHf3hruJqzyMKMvHmepktmh0Nq5D4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbcebfd6-7eaa-4fbd-b4e2-08dc2f342077 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 21:13:31.0724 (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: 2EF5CK+6GeeD06MXZ4JTW4g3vl6p1x8akwnJYrFxoGr+C7PA8N9+VTKLrZODlGWWhpaJNxvTyHDBlJEm1CQtJbgUgSulQihInhsD06k7N9Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_20,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160167 X-Proofpoint-GUID: 0UPkmgna_Gs66oS7LDBjgOmhB_m-hQWb X-Proofpoint-ORIG-GUID: 0UPkmgna_Gs66oS7LDBjgOmhB_m-hQWb X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791091955441700422 X-GMAIL-MSGID: 1791091955441700422 Use folio api functions from the already defined src and dst folio variables. Signed-off-by: Sidhartha Kumar --- v1 -> v2: use migrate_pfn_to_folio() to directly work with a folio per Alistair Popple. mm/migrate_device.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 3d3c2593b5b64..81623f2d72c2b 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -814,42 +814,39 @@ void migrate_device_finalize(unsigned long *src_pfns, unsigned long i; for (i = 0; i < npages; i++) { - struct folio *dst, *src; - struct page *newpage = migrate_pfn_to_page(dst_pfns[i]); - struct page *page = migrate_pfn_to_page(src_pfns[i]); + struct folio *dst = migrate_pfn_to_folio(dst_pfns[i]); + struct folio *src = migrate_pfn_to_folio(src_pfns[i]); - if (!page) { - if (newpage) { - unlock_page(newpage); - put_page(newpage); + if (!src) { + if (dst) { + folio_unlock(dst); + folio_put(dst); } continue; } - if (!(src_pfns[i] & MIGRATE_PFN_MIGRATE) || !newpage) { - if (newpage) { - unlock_page(newpage); - put_page(newpage); + if (!(src_pfns[i] & MIGRATE_PFN_MIGRATE) || !dst) { + if (dst) { + folio_unlock(dst); + folio_put(dst); } - newpage = page; + dst = src; } - src = page_folio(page); - dst = page_folio(newpage); remove_migration_ptes(src, dst, false); folio_unlock(src); - if (is_zone_device_page(page)) - put_page(page); + if (folio_is_zone_device(src)) + folio_put(src); else - putback_lru_page(page); + folio_putback_lru(src); - if (newpage != page) { - unlock_page(newpage); - if (is_zone_device_page(newpage)) - put_page(newpage); + if (dst != src) { + folio_unlock(dst); + if (folio_is_zone_device(dst)) + folio_put(dst); else - putback_lru_page(newpage); + folio_putback_lru(dst); } } } From patchwork Fri Feb 16 21:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 202370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp792486dyb; Fri, 16 Feb 2024 13:20:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9+nh8XlJLhDhV+yMrdqrbzKZB/9cm3sfSpfHFqg8ODVvWLzt0WhQomy8AN4nK50s6E49HFrKlaMJLeYpF5E7bMSn2vw== X-Google-Smtp-Source: AGHT+IGmi6wZN1+tal0xcSMH0WnM2gnvqRJHUmTQs8UnEuW1qN6n0t62lUnS/6hVC1X9SUZH/ETn X-Received: by 2002:a17:902:e805:b0:1db:2a1e:d261 with SMTP id u5-20020a170902e80500b001db2a1ed261mr7582132plg.2.1708118410936; Fri, 16 Feb 2024 13:20:10 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p14-20020a170902ebce00b001db4288f65csi426922plg.578.2024.02.16.13.20.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:20:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69354-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=SvJaCzwu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CbBw1b2n; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-69354-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69354-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 819B928611C for ; Fri, 16 Feb 2024 21:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86B4B1487EC; Fri, 16 Feb 2024 21:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="SvJaCzwu"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="CbBw1b2n" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A20A11468FE for ; Fri, 16 Feb 2024 21:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118039; cv=fail; b=N98/lIy5FDwaKna3v+lUJhw/4MvY1vLWQ+BDcMgvqh22tRgPL1SsbJ4sm6U++aMbdLw49nqwrMH0Ehbkb3UU04s9TNIk/2HDfCB9fZotpSB6h0P15bpVtfDUlcM4720+uWzZnWuW/pEOxq+7AJlbLykpK/+wVUNsYsK4k7DE7fM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118039; c=relaxed/simple; bh=H0JZum5ES+kw9HDtgbRLmJS7ZMB/DGKWwIw/KZwLn64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=c+fC5lvyRNX2sHePThWkQnM9gZfxe2FBln4u37Oe+odH2mu1cOnEvCyYR6gp95srMTB4lI8UcVyNIVho7iF+1NPr+taH+JSqGDPEwuffiKmOHV2fpBsmo5soHaRh+dDWFs7xpm5NRMqsMdQkToDpj4xu0vAEAHQ9zms5aihkyzo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=SvJaCzwu; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=CbBw1b2n; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com 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 41GKDor6012510; Fri, 16 Feb 2024 21:13:49 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-2023-11-20; bh=Zyj5W/hf5fQSEZwMGqMHlWaHWhn7dkZCnmqh3nzq8a0=; b=SvJaCzwuFlkngzUkH6QOCm6LPDEMMxPgwses7Sz9fnOUPtCxxDb9CBoYiuYGJvp+cTrK j4WITKH9YivFJrAHkzXdF6L2rP1gK7vUp66NngMvdqwUc+NWeAfZoO877p2oCRAqukqb 7AxDqsZ8HNmjvjjwO0Vnlv28otLHVaqL3iWlxxQWJ80WSubcSpaf9ZocaWTPw8Fbe3QH foqiEJOCzb852x/eD7v8lz0ipQ9tLXN7H3QZKVBOnBE/ht18Z1GjUMW0O39QVvPvPkmC ryocQsVxDfB89hBugi/pNaxFzlXMYS04QXytQHXoBuqfYV1N3kJzb9IjG+VZG6V5clQ1 Xg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w9301659j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:49 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41GL4CMO024548; Fri, 16 Feb 2024 21:13:38 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykk0v8y-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IM8Z4Rg7sSGh5h+SXJcRjXElgZGT7mC35vy3bHb76TwEBdgxz7BG6VY/yPADdfJq+xPSuInbEFdaiK6jglKT6A59HwVn+bgmF413d36Fy9HWnKmdN9fTVZdvcLuHXHXAmGCEo6l1SbPfbJANL/pyaK5uVONJKI6vDGcH9NrrzLBpQHhg9pcdGC2vRHIL1x3sAye+XbQO2jpHlWKOy+C4pRU3AFtGe2VUX/bfVvtnf4ftCoMOUYsDdCtNHS8moBEZRZsbdrxEuGnuK9avnCVXVtS3rupEsY3wqOipsrty8qoirPBYOquVPeK16M7g4Wcp6kQk21D3triAy1yzCXjkNg== 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=Zyj5W/hf5fQSEZwMGqMHlWaHWhn7dkZCnmqh3nzq8a0=; b=WFRlmtUJZ1Jb4y7TaOrhHEK8VPC0mrEZ2b6DHaireyHCYHJjuTEZGaR3fUWKLAjkMrW8Csg5vnHpDyhXdgfeeLJ3J7iN0sCTY0kFyBumQgfqTRrG8ksF/PUCXBqsrn0ZQaRo4Nrd8nVYiqQSlzls17LWwAEoiJc7cG2yhKqIJDCVVG6TU/NvYs64bKDPbx95rnjxynDZZ6NLblql8idLpvEayBkzsTrudwt2JwJhNVjkpnh1H9lAXg32Hc9RNmCDW0Jub+WK8wmyR7Mo+GrGWj9l/CWbXL8J9eurQRKSkftRSE/Gf1zONrfOLsC8pQh2NKzncoxHFQ/hDHbICTJJuA== 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=Zyj5W/hf5fQSEZwMGqMHlWaHWhn7dkZCnmqh3nzq8a0=; b=CbBw1b2n4wxdDJ7LAHgpFUR0ZiVi14p/nwqAd6SCobReksXGw8OiYeFIVmM7FGM1ty7B+6AiutqI2KntqMiIsFKU6ozuWxduOLLtBEx2PbAFc1r9Gw5zTif3w7StngmXBKgqLnDQACrmU+8zZoeaBwR/sTxGfNIrECLXjofi9L8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS7PR10MB4909.namprd10.prod.outlook.com (2603:10b6:5:3b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Fri, 16 Feb 2024 21:13:33 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14%3]) with mapi id 15.20.7292.029; Fri, 16 Feb 2024 21:13:33 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, apopple@nvidia.com, Sidhartha Kumar Subject: [PATCH v2 4/6] mm/migrate_device: convert __migrate_device_pages() to folios Date: Fri, 16 Feb 2024 13:13:18 -0800 Message-ID: <20240216211320.222431-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240216211320.222431-1-sidhartha.kumar@oracle.com> References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BL0PR01CA0028.prod.exchangelabs.com (2603:10b6:208:71::41) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS7PR10MB4909:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e271ba0-0976-4c89-cbb6-08dc2f342218 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FUyb7f1munmSpR/UF2LJPu05v+cEdkvEzvd25TvAFFacogGUKkP7vRcx1BY2CR83p1fn6+awsmgrEubIH3Z1YXVDt0KwmW07GhbXdJkriLCrdpBBZ2k5QMHpO195tsgsBvCW3Fwosn6WaJll1sFol29EkCMRrM+Yr4++/2WswoBjMi6Cfa9vA2XjZOIT0+8EsrehzcqsvnCDSjPPHaGM+j/4bJmiCROuLGz24MZ2QpSRP1h5tO6vm877Cbo5YJV+xeUI4Mm3yEhiu1D+uZF7uGCZQ/eZ3pwZvYbBbZ3t3KAl50Cs23K6L7QcXuBsaHOWKTx15yl91PKTt0aJSdvdnoeNJRmIug0Ha+B3c182D1mZx9IU31KYQ1kTtstY+cfE7hHTwlvJo8DDzMqgVcgBeBl1nbfBemD4/FWcZXXKzyYDQzdGWw3yd14Qjwvyy8ffxJWaDrtQGPYi+5ndHcyv1F2XSfOaRh3jwQYAVFRs/xLSdXdND/CyI3SarDgP5BwIRKU+57URkT1UUvzYhmeNG769/iMrrUiL0donm66oUlZofpAk2bIVxIDiJ0vYXv+o 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:(13230031)(346002)(39860400002)(136003)(396003)(376002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(86362001)(36756003)(38100700002)(6486002)(41300700001)(6506007)(316002)(6666004)(478600001)(6512007)(83380400001)(2616005)(107886003)(1076003)(4326008)(5660300002)(8676002)(8936002)(2906002)(66476007)(66946007)(44832011)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4xIVIZPamx/1xZcasHBsVPox7dPBNcBxwLVYz8+1qZUTWPvdJWSEn5odBqJstOYwLHtU+zgkzuMCxCc6E7Nte68k5RiYY4Hs9MdmEkR7T4Q9HDxUEBLUAbD+aL1tdh/7pkveIeXrpXV39vYdHllw50JwJsOHo97gcGCG/USwYJrlj1QflEYguLRTZg2pg1XRISNSoH8F1el+MtyAsIu4sJr/kunPLIksJf/4yJFH243Wj9QnZ0IttKKSJUqjJT84unmIqhfNf/XwEJK1uv6DJTPvxLHX4bNpU+Ol6IOcQWEb7I0YzWltfkm0g0TUCCWzxm6xQZaWtyUTn2occL01qzv3/5Dh7zldzcLY0Jw5VrUeRC3of9rAkTW+9MfoH6Bbc22g2E8pVAK3gRV1xrNPK63T6VkBa51qK6/qbpuPPILAW+6+sWE4VOXQbHxuZ0OZNEkmn3uaNkPmqkPyiZMD5ArkLC8hHaGRkQlfAi8SfN2URPIUxzEpjJ2f5qf4UFOreTfwzTsjCvQG4DqG6o88l/kn0Bmwd0MgcBNpUPUo/ewte6B6+S6lym03CTs/Bs44QoWhgfT3C65Tta4BdXnrIpXyviii0pl6DtOUtP+4HSAI53O/hiJ7QUvIFWg8WtCqnhTQufyLzRXLOMAE6UrJcKfLghy9M2+CScqzfDuJW5IzgoAd0p2QypvFpNszr5Cc+Y8+CdEHyOSVr2pY0CTCUaPVEJR8ngGihbW3ymSz6WlV28LUvN0ZhfdYCaQMijUfd7BrTIX32KXoEzVoI98nOUqR4HpUifz+YVyJDsQWJ2+s/0NAvcZ041qCxJsxxYPPiDgGho4thTvpXvez1jpcKrXE1QZoiRYFnFsEr9StAOiaFiXeBDYq9j9BqAeRuVcqsxpOpil4l++NdY1nArTnLfg/WBCvo8v9IqqaiLEwlx87nPK4YQqtyDLQ46Y781zkblRTC6t+OEVBPm9d8qDH9x6wIwY+aDz0MitdCCRXy4n5MVHUKef+whOGIMpguCvY65xYogh68ardle8xlKWXOOHLCc09XUkFn/wdHlPqobqxR321PtxRcRskuUtjvt7nzQOqV1wRl1vGTe5WPGA3Wqtp+8FhBoMrIvBKTOLvKAeL56lEocf9ifCK1rVcMRpwmEjmEfoWqQ7ad1n7JuLQR1z1sg+nP6ojb6MQaIJZqocNOvSpR1evfkgNtzbVwSfahHMkgjsQoAfAdoGAGZUQFYm37gW2yPRi7E5GeIelHCdCyriYHsUWeC2TK8VAlCb097jJZVgSS8tCU7CbubsiF9m7fJpoQNqKMjsGQ5GaFeSZdX5jnWD/nMLQqxYnCHlxVR0OFL844cvXmnYqZFyC8SKQ/HV9qHPYXSo64tJT02a1JltTmIwQXM7fH9bu6bRu5PgnyVrPf3WQNWiQQ6SWZdcaou7jiCuiEaZjTvvOl3TOb4BFjzA5pR35dzYVgAS01fRCF3MShog84TGbWUyO2LKGFYq0Caph1n4eXLemS1M2+x25zCsFyW9Ti16H1zjjcjWPjk5ddIxqgv5mnuLWhrez2h1SOqfPfiDe192OsgxZfeC6nB1/yKYdNDD0/O2kih952pVKV2/2pklwSSIVGV6wuTmg7OH6KbvCIKmKvuY= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 65DvB0RVyAHZmhsDHyznxtxkGOfObuL1AtS7jIc/k+UtshofJxQPSFL+hLkCs2ofdiC2ZF1CYeJ8aOqZ97BisxNX96J2Vqksmg3YzeU2kBtxyvDrxe9yXOxQQ9pBreQ5ICSIAwTcp5bK21bLlgoXlgkjjIjvcf2fyZUMvtgF/MKLfEQpTRqlsl69cOXKqCyht/jL6mhAT9MIxG8+SCqcgMG+Vn5qpOk6YPz7G3dvG+Xj/II/Awc+H8wEzBLUns9XrD7+kZtTOZzJ67lnDpeVcwZ3iPgVGoeCdQDQS8u7E4oGmpMC1gIPg6oW2sT+9cVTFSWPwafiffQqoqquNr/dxhzWw5xyWfGLnfZAbA9/88ahfCfcSQt1B5WG0QB7tTwBYje9nK6VR2PFCv0W8Vgl90xjsUMr3vDLVDWBTiEtuJA4jWCVkuJxGvQk4Jqa/UQev5q0Py6rKEyNL1fxdDLVT1WnwzW9u7Crlkd0jc4PVqghS00ovRrbNKk3Wu8hHyJwXAGNsDjoBY5H05hBQNd0W9A/wxG25BLR7kw0sf9O5mZShUhu+7rgbnQtpXeqddiWSNuKSedFfxUrHc8yYYOM9IZYj006VSww6GFRWhwqSUA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e271ba0-0976-4c89-cbb6-08dc2f342218 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 21:13:33.7990 (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: qj993p6B44s+1iA9mSiSeuKOsq3KxFGt+9cE4yKuCbwMKPsitfUJR8/Ws8NGDCxUqqqjowpJJH7erzomenDftCZ/Vwt2gPdjrGGU9jaF0JU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_20,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160167 X-Proofpoint-GUID: 02ZLLdcM3jvpYzz0UW4H6UAdR0vVPaK2 X-Proofpoint-ORIG-GUID: 02ZLLdcM3jvpYzz0UW4H6UAdR0vVPaK2 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791091970750049083 X-GMAIL-MSGID: 1791091970750049083 Use migrate_pfn_to_folio() so we can work with folios directly in __migrate_device_pages(). Signed-off-by: Sidhartha Kumar --- mm/migrate_device.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 81623f2d72c2b..d9633c7b1d21b 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -687,17 +687,17 @@ static void __migrate_device_pages(unsigned long *src_pfns, bool notified = false; for (i = 0; i < npages; i++) { - struct page *newpage = migrate_pfn_to_page(dst_pfns[i]); - struct page *page = migrate_pfn_to_page(src_pfns[i]); + struct folio *dst = migrate_pfn_to_folio(dst_pfns[i]); + struct folio *src = migrate_pfn_to_folio(src_pfns[i]); struct address_space *mapping; int r; - if (!newpage) { + if (!dst) { src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; continue; } - if (!page) { + if (!src) { unsigned long addr; if (!(src_pfns[i] & MIGRATE_PFN_MIGRATE)) @@ -719,33 +719,29 @@ static void __migrate_device_pages(unsigned long *src_pfns, migrate->pgmap_owner); mmu_notifier_invalidate_range_start(&range); } - migrate_vma_insert_page(migrate, addr, newpage, + migrate_vma_insert_page(migrate, addr, &dst->page, &src_pfns[i]); continue; } - mapping = page_mapping(page); + mapping = folio_mapping(src); - if (is_device_private_page(newpage) || - is_device_coherent_page(newpage)) { + if (folio_is_device_private(dst) || + folio_is_device_coherent(dst)) { if (mapping) { - struct folio *folio; - - folio = page_folio(page); - /* * For now only support anonymous memory migrating to * device private or coherent memory. * * Try to get rid of swap cache if possible. */ - if (!folio_test_anon(folio) || - !folio_free_swap(folio)) { + if (!folio_test_anon(src) || + !folio_free_swap(src)) { src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; continue; } } - } else if (is_zone_device_page(newpage)) { + } else if (folio_is_zone_device(dst)) { /* * Other types of ZONE_DEVICE page are not supported. */ @@ -753,13 +749,11 @@ static void __migrate_device_pages(unsigned long *src_pfns, continue; } - if (migrate && migrate->fault_page == page) - r = migrate_folio_extra(mapping, page_folio(newpage), - page_folio(page), - MIGRATE_SYNC_NO_COPY, 1); + if (migrate && migrate->fault_page == &src->page) + r = migrate_folio_extra(mapping, dst, src, + MIGRATE_SYNC_NO_COPY, 1); else - r = migrate_folio(mapping, page_folio(newpage), - page_folio(page), MIGRATE_SYNC_NO_COPY); + r = migrate_folio(mapping, dst, src, MIGRATE_SYNC_NO_COPY); if (r != MIGRATEPAGE_SUCCESS) src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; } From patchwork Fri Feb 16 21:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 202377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp10873dyc; Fri, 16 Feb 2024 13:53:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU6+2g66SAgBeWsI1JfGjP5HhPykLF9Q1KW7PZCLqZ7jeAE3XGTeGcrGjt3LDKWN1adOps997rIbcxwH+3Q6duQsfDWRg== X-Google-Smtp-Source: AGHT+IH+LoItbzBvbC8EUfT0lG9LWR///nr+AGBvHAk79/TGkAA9+RKEjRfHvGb7Uuw9uzMht9IA X-Received: by 2002:a05:6358:5925:b0:17a:e17f:7f01 with SMTP id g37-20020a056358592500b0017ae17f7f01mr7150161rwf.23.1708120388863; Fri, 16 Feb 2024 13:53:08 -0800 (PST) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l8-20020a63ba48000000b005dc8922fe5csi473345pgu.457.2024.02.16.13.53.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:53:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69352-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=kdPOxaJR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ib9k5B9A; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-69352-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69352-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BB2E8B2C0D5 for ; Fri, 16 Feb 2024 21:15:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4CFF145FF7; Fri, 16 Feb 2024 21:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kdPOxaJR"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ib9k5B9A" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5072B1468F4 for ; Fri, 16 Feb 2024 21:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118031; cv=fail; b=FB2AuCJ9i405r/RQjt1/L0CCtck0+ZtFXUrmjQ0uO4In26yVi6SVayT6jUt5V1q7TP3bWeFjRzxpmaKdcJd/T3wznOy2yErqm2fcj6vyTHFF7K2B4rXIKgdlfvFKsKrxDkxQmawh9kaxfBQpluliVtl1cXsaqXW5vg9FUeIIolU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118031; c=relaxed/simple; bh=KXfmiuJOAZJqzhSBzWDrkSQJHrgaObobh7xgUq6C63o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=eVC7cMgQ+vU4ZT6+2zwopwr9VUiTEyJqewZMFMpOwfafaB6YhTGjpbF13sG06V2rQ0cnkfnWjg1dDyp1IQ/C91kFT8wrjDDGy5S5JVKeWjjFg1a4OVVOpERmt507ehAqscQIKk3NiEZ/nf6QhltaM5HCBYF7M0hhbt9QQFFXlKs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=kdPOxaJR; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ib9k5B9A; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com 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 41GKDkCW012190; Fri, 16 Feb 2024 21:13:39 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-2023-11-20; bh=PULTjpQ4CgKFl7QQYFQWEw7UCRXWWaoj/fracxY/qoc=; b=kdPOxaJR6iY5Io3AphNBbwNdkmtb8bA0BCvvmMXa8jKEufwPunQDWkIwfAwYpKUnmMCE s+YqH8d9mhxfMz8a2pi6NIT6betGgsJXLTiIRAwpdww7h+KZ8DNtH81jX7bh2+/Lcs3j 5Io75iiq2qkMq9VVgyzCn+DXzYy78C+WvfyKnebPUopPqLW9DXYy7oke6jWAlozZdzIM 7qYs0Rmf2GpRCPo1SsqrmjeAzt1W10vOKD8HFkVmzZu6IwHU+Ev2z870WwS2gFP+OiDg OCyJzGYMxDaEZeqfsTjoJTk7sm88AT+Bj1aso8+cNBjDOwMiW8EVNKEYXPBHsC10I1s9 Fw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w9301p5vm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:39 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41GL4CMP024548; Fri, 16 Feb 2024 21:13:38 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5ykk0v8y-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZlhbG+P9lCtFZIaZVMBZZBvmGG8/3MhyjQ0HVNfkyXz8bGZ7PvIZFu7V+5lnEyqGmtGV1T5pXKgB41GbiELHX9tB0n3jFIEv7y5R+7kZ/qxJzPdzVNl7+7nj54/OO3cCA7NAe1ZVoCDtjooGYxEGP63A+FJH0HvoEOWmf4hxN6ku4odgfFzye9ECcsfBugKgQ8gmPJlOO2FUcfSiO/TfRvLNgqnT5ciU8s3E53sxzauxlyfTudRDTtcLRWve13u+Fm7gQB5qkT/Hxi0oUYdZGFuHMV92f9X3amaUaYJLjReBWYOOJ5IxtjVm4Eeg3naVhYvrXVl8qzWvgH74v5FYw== 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=PULTjpQ4CgKFl7QQYFQWEw7UCRXWWaoj/fracxY/qoc=; b=YsrEOdhT+2HdNiR1eut8BWH/VI5s4YWA81IGHAK5EQgbx6phVUoeKNORLkdfT8T48VBfCBHSauwF2gJ1EKZeXEY0QO80cLQmusQ1Ah+JeN7RFGphJs/z69e66jGHTRxH5nGT6pX5kFSDutGeoUWyqEv3B/XD46Uep3oCHLuFJeIFzWzexjsmyJeoE/uVgdFO9itLSgD/Npo96I4l95MA5N7C3Gk+EQO2p7inOA2ZfJ2SL4DY4OZk4Uo6DrKOgfMJm5ZVqOqW2FSZC/PCvomhMWPKxRiWCOSJPaPhDOdZJPvcGTGWNm1juvD+uyfA2lASR4V3CH06JWgMpsnPVc0WUg== 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=PULTjpQ4CgKFl7QQYFQWEw7UCRXWWaoj/fracxY/qoc=; b=ib9k5B9AeozOi3TZnfeXrneZA7qWBYviOiwAlFjFGiuKN9hguSfQPj1PffIyIQUIV0S/Lfx9NxIgxqSFSwFKo7VJd881Aw2hVxkZ6mBAk089NyfMBJiyBvILPYh2F3YoE6qO7FhiVHc1lWxNq5vTeSzUlYgghXqa4AwQk/uauvE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS7PR10MB4909.namprd10.prod.outlook.com (2603:10b6:5:3b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Fri, 16 Feb 2024 21:13:36 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14%3]) with mapi id 15.20.7292.029; Fri, 16 Feb 2024 21:13:36 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, apopple@nvidia.com, Sidhartha Kumar Subject: [PATCH v2 5/6] mm/migrate_device: convert migrate_device_coherent_page() to migrate_device_coherent_folio() Date: Fri, 16 Feb 2024 13:13:19 -0800 Message-ID: <20240216211320.222431-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240216211320.222431-1-sidhartha.kumar@oracle.com> References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: MN2PR14CA0001.namprd14.prod.outlook.com (2603:10b6:208:23e::6) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS7PR10MB4909:EE_ X-MS-Office365-Filtering-Correlation-Id: e722a654-4602-4d40-9609-08dc2f342375 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iec0L2bRHgZCzPu9w+VpfjpzRX/Fauc+0J6dRijpPKZIrZv/aqIVvKHksJDFA/jvTSOYEJIxwyYOtRQOzcuZQUm6kT7ds7pflcS2Qplb0QW+EDzdeE4qvJEuEjSy/V73+DvI15bbONxbOmqKOAe5GX2DGxRnh484yeJq/70Rvb7M64qVDJTeLhw4poid+Ps+isdUDiwb15woGwGtaR5mywr8KtpTxMMMNJ5kbSdjO+3jB2FVeAhDorMEUoBjXLgdXczK/0//5iIwuL4I6uvNZ+woHtnL+4MN7wyxNREd1NRO3lxv4opr2Li2vMyGylLSzqZJodOELScHpV0cdOEkwLwPZxEido9/MPirbszQXvL7NzSRUraIrs4dp9h4rz9qpdxx35hlIQIh4dTC6y2XSUv/G3AkNYt9kd7b2scQicleKYYHrPP6I5xXOsfxhaQlf4P+8l0WLou9ZKNxgR8uAsgqkqrijXBBUI9T+DVz6XXXRn5Jzc9I8o6IH2xjsvI1Y2nhijsjIBKi8rT9+Hk8h7+ZBqvSkE3BYbrGO6JQtAaCTLF2+fOWNaM33J3f/Bjw 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:(13230031)(346002)(39860400002)(136003)(396003)(376002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(86362001)(36756003)(38100700002)(6486002)(41300700001)(6506007)(316002)(6666004)(478600001)(6512007)(83380400001)(2616005)(107886003)(1076003)(4326008)(5660300002)(8676002)(8936002)(2906002)(66476007)(66946007)(44832011)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lNm7eksCAllHlXkRreaqDBWOWzQZWyzt7d7oF6xBKNSfRE256fRcoSLPVJiXGJdlmYF7YnnXoea1Tc7ltxIQOgjOzcE/bHQD6rrTmdxYpDinxiQcXfuFHqUIhImTh8tjF9tcaYJN6cCmpYU6ANbvy/lOcvGvz/amBcloPsCGbyR1xMI1DlFYGDbkwkGFkJ5oWBude1mpVZyXzO3A//0oq8flpF9bM6d7r8OLxZM+BhEHXiL6+6U7DwiRAtkA76SHtHBsJjYUBIbkhwNnWuley3brRnaQruJRHTVcyiYbqJss4tvfodX2hyqjoBPyLxHiEl8uyLJi0ltSddI1SUZeABO9s1MckdXl8Rus4Eh37/fOAuOGWUoJ6FKyiOZ43Xp5+PaG176heNKJ6+qUmu/Rp3vP6cjnxnH9M+dfmwhQkhBJK/j8QxEJFBPhtJgvYf9dEPeb9pHoptlGfg4r8QyzdXlnGWlTFFnLH4SfR24mUf/rnjHrpQFa7kU/7mXnxYFFCXLPsxC3YkA8MK+hwUR5O4xkHu2lq6+g4Hh6C4KWTd66Eo/qwXWwMeKH9j0OOL86UabLFTrMzBOSrkBClHjIcD6ZUaIq5ivQsY8tK2hkK5EHoFPUXir65rO7uc1bvGDtIajNgwgSQ9DsSOEXr5IEHuKHX2MXPetqUc0tom3hLLa/vYlfV1k8tVFXbULjD3XfXMCI8QTsFLg/p7iAUTUp/ogVI2vE+xodOsexCkjQbNP+1l0IjNdRwfGvACIa5P8rKmjH1CX2rYdyLTW9TgwF2sJysbMEiFFpV44BOGmpq0Hf6m1pcmrVYAsVlNBH6CqcLlWpQX5NKs9NuZ/333di7ReUy5twnDAC9zMxJaU2LElfseF9oCQeLfBo79wS64L6WXKjA7en84qU6aZkCZdsxCaNwsAGlZ3k1YnvEQClfxQuIG2jug1LI2mSSVZGURxx6oRuRLQhaWe5PXRNCZWuN3ujBgtUjZ3siibxKB5UNEt8oihlLKyhWFx2Yu8QhgtIpV2p6VxAz4jsfDa05/oKxrG9leXlVDsh8Uz+0vqKnymEsQ0+XoQFv4p13qvRRaZ2WGLge1NLE0PYU29rZX3icO2V+PawCouAMwgKQmC02+K5303p4ODEdoWf9NopmsR7oSPPHY5JaRoq5kuaE5YFVeCiF/qQnr7dTskMlrOT6+KZN49OUHgAly5r71AsamjTqo/YdYpchcC8BCigf8q5jr1Htkm536/034kyD/E1wnFIvYC8NctDVri2zokofv2S+lj2ET3P6/FCX+VClqU860N5jQ0k5loOQEiPv75ezLOCkikLKfnYb1vMqbw//tABX//DfoctODvzkkOn7VFhMjT5ilNLYsqtE5tmXRCLd97CvSbdYzuO5gFNd49/6qgR1hFJoNdf7FpkwkgquVyM8A1woh2iORRZLAnrBSBW6Sa/exe97Pvc1sI6En9XKisr/ld0EbNy6Fsr/p78K4DGIdpbMkxTTVk4TjhhVVcWoij4YpWUqeS4he8YgOkmIc9fNZsz9LNtGjGykzOiVmIwncmn04oqSUoOEkr+BCRH90NSf0BWhu4PLKh+0lCpE9ue1NZm8GNTCX2qRCKqB0esrxDrdIljTnBbRPa2cWm23fo= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PiW5gTH0Qs7hETzQfjgMBRnAGpe3GjAbDbKARFXhA5eg4hXj/kW1UkW2+z4WADzIxhyqTaDLXPQaD+yuFq7HO6Ew+73V6VFwgKDsnW3hQFMS9Wuwb0GPzbndcOD1/AH5kpMvL04kPEiSPR9uQe8JScE8NVRL9chreoWaqelAyats2Sq7CwjWdO2+nBXlYzE4kCupGdot/ySiHNK70GaVyeA5ZtfTZokKIlrTLB0FhUcu17jVQwvv/bEtX/KbUGEaNvbjb4ngzzSqALw3ZpEJT2H5vAQbkbxAhrgLnZz/8iFcpgsjO9H3L7DrgVQVjNq3hQpzVU00rP6WgN+l5lVrc7Hfj4j4hluab0+xxdHINW79EmD4MTQApx6PiTO3WNUQZ+k3+NgWzYsVLsZMhzVDR+qPZ0OP4pif7gTeFhb0EF8WYuYr75lf6fHkdHEK51AmA0DKkvnItTKX73JzHMlP51x5pUwHAbk6QM+g/81MIdqQ90Ci28zXG5pgYtJzA5hXduYvrelgepv52e0rtbeaXsBP8rivNsvVd9uFpi+/7ju6UHFIhk3vBLYqUfnl5l/LJ/yOILjawFqtfZLCBa/ZSbMdi61JDrHpys9T5MJlkU4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e722a654-4602-4d40-9609-08dc2f342375 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 21:13:36.0882 (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: o+hmmwcIVBIxSP65GQbBJk7L2qw8jae56N5HYTPFblDWxS1y6WEQNCY71y10vcVhcZbcco7yTBt0l3YO93hSVEB6Ax+bWXB77Ju1Ixy3oC8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_20,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160167 X-Proofpoint-GUID: 9X9YI9CLK4D13iF2kKjebom5kvh4zd00 X-Proofpoint-ORIG-GUID: 9X9YI9CLK4D13iF2kKjebom5kvh4zd00 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791094044778730215 X-GMAIL-MSGID: 1791094044778730215 Rename migrate_device_coherent_page() to migrate_device_coherent_folio() as it now takes in a folio. Signed-off-by: Sidhartha Kumar --- mm/gup.c | 2 +- mm/internal.h | 2 +- mm/migrate_device.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index df83182ec72d5..2c8b183b94485 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2109,7 +2109,7 @@ static int migrate_longterm_unpinnable_pages( folio_get(folio); gup_put_folio(folio, 1, FOLL_PIN); - if (migrate_device_coherent_page(&folio->page)) { + if (migrate_device_coherent_folio(folio)) { ret = -EBUSY; goto err; } diff --git a/mm/internal.h b/mm/internal.h index c6ea449c5353c..32304bec79f3f 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1003,7 +1003,7 @@ int numa_migrate_prep(struct folio *folio, struct vm_area_struct *vma, unsigned long addr, int page_nid, int *flags); void free_zone_device_page(struct page *page); -int migrate_device_coherent_page(struct page *page); +int migrate_device_coherent_folio(struct folio *folio); /* * mm/gup.c diff --git a/mm/migrate_device.c b/mm/migrate_device.c index d9633c7b1d21b..5c239de0f08b2 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -705,7 +705,7 @@ static void __migrate_device_pages(unsigned long *src_pfns, /* * The only time there is no vma is when called from - * migrate_device_coherent_page(). However this isn't + * migrate_device_coherent_folio(). However this isn't * called if the page could not be unmapped. */ VM_BUG_ON(!migrate); @@ -915,15 +915,15 @@ EXPORT_SYMBOL(migrate_device_range); * a reference on page which will be copied to the new page if migration is * successful or dropped on failure. */ -int migrate_device_coherent_page(struct page *page) +int migrate_device_coherent_folio(struct folio *folio) { unsigned long src_pfn, dst_pfn = 0; struct page *dpage; - WARN_ON_ONCE(PageCompound(page)); + WARN_ON_ONCE(folio_test_large(folio)); - lock_page(page); - src_pfn = migrate_pfn(page_to_pfn(page)) | MIGRATE_PFN_MIGRATE; + folio_lock(folio); + src_pfn = migrate_pfn(folio_pfn(folio)) | MIGRATE_PFN_MIGRATE; /* * We don't have a VMA and don't need to walk the page tables to find @@ -942,7 +942,7 @@ int migrate_device_coherent_page(struct page *page) migrate_device_pages(&src_pfn, &dst_pfn, 1); if (src_pfn & MIGRATE_PFN_MIGRATE) - copy_highpage(dpage, page); + copy_highpage(dpage, &folio->page); migrate_device_finalize(&src_pfn, &dst_pfn, 1); if (src_pfn & MIGRATE_PFN_MIGRATE) From patchwork Fri Feb 16 21:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 202365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp790112dyb; Fri, 16 Feb 2024 13:15:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXqBliVRwumoKoqrVTtp6ILkTUdqnxF39sx1kDGeA+45NhmKmPRJU8znFcEY3GOy0I3A1/T3UQaSiV3ATj14IptgebSJA== X-Google-Smtp-Source: AGHT+IEmlQrBFIOPmDBfOVFst01WvqEtidfiNvwOIEVdURltMmH869ETflBs1SG/+gfSAgult54X X-Received: by 2002:a05:620a:1478:b0:785:504a:88e2 with SMTP id j24-20020a05620a147800b00785504a88e2mr6430015qkl.66.1708118103705; Fri, 16 Feb 2024 13:15:03 -0800 (PST) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f20-20020a05620a409400b007858d881c0esi916466qko.415.2024.02.16.13.15.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:15:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69353-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b="JG7/bw9J"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CvJkzwvJ; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-69353-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69353-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5EBEC1C22E80 for ; Fri, 16 Feb 2024 21:15:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40D7C1487DD; Fri, 16 Feb 2024 21:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="JG7/bw9J"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="CvJkzwvJ" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 906AF1468FE for ; Fri, 16 Feb 2024 21:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118032; cv=fail; b=RMaCbfPIcVqu1rnVarE6322xzFI89GTDd4K/5xlqCzt0IrQVDkTDu3P1KM8JzHOLLiZA6C2Rx9wu5aCbITeKzlFysNzo4HW5RjR6xMi/zXSmsuVLUhSMO/23dD+tgB5FcjqzKoZa4zNSguOOYCA+J7EXZWo8HUZWuFwTFiuv+G0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118032; c=relaxed/simple; bh=3zcw9mfZYh8b7AeD2C+BrgEKHUQLVgfDY19NUnakl6g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=szJWJxg4nsL/ylBMDpAGrVtKuFLTtEsfPI5eeheemn67mAWRzAyA87mwS0xLdIeY+ob63ipCxM3GL4cue+mw9IU9mSmKAYq8sIJB1Pf3DCZZY/YqFvmSBLoixo7ag/LDQq6a9jbkJOUGBpg3SKsymQrzHkaYJFUWO8sTnS3CvAI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=JG7/bw9J; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=CvJkzwvJ; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41GKEKPo029625; Fri, 16 Feb 2024 21:13:41 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-2023-11-20; bh=GHBrn3WQf74ZkfOmgCt1XexJieU/u7v9XU3QWsuaYo0=; b=JG7/bw9JixlgB9jkO2N1Ps+5ZoF3Ge+lx1l98ZXKcvY/2Ir245T83hxBoruYT1OTMy6y z+wGCtUXN2CqFmDLpQI1+KrkhB/n+gexpEnckQcwVevwjskW3TAnXc4MyiEaLQ735wtB pMaEZclBXoItxoU0U07vr8wnLxaL85sGt8kJ+S6f8qKJS/Uv54TJ/KGbv+UjmN76dlGh TQptkVKnvPklvhrVD6ewZu77cyTvfdRGbhzVh+C6/70AmDfn4Bfbbrz8U3IUX5Q7fdFQ 19JxO+CdTDadCGRDGIFPRAaw/lpKf3YU34iJOcr+gUguEExAuyT2sy/NgABggwRgrnKO pQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w91f06e5e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:41 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41GLAsSa013780; Fri, 16 Feb 2024 21:13:40 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w6apfpfx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 21:13:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iEqN6TmSO/BcigAkqZ07or4Jf9zdFSiNsVzL8cjv8iqYRfwxL2HOD+KZC1gWLTWSQ/V6iXgqJ/pYXzpcYbTy1MBtAydjEe9TYRNafURtlaDG3/3WS9egYY6r3CGVW7+GQRdI+5xMGUzMmXHkbkTmF4cuNrIYYxNKbOYCs6qrJ9sZAPt7lYWETJaCkxbB7d6srStpjKzJIV+OUZC/6ENXp/y1w1+YPkYnQJcqJs1dJ8WTxt4GM1MKGtdu+pXaPYTftz0+J1mLw2FvJJfy+1NK5J8X9aMRxf9eyGAgZ8okAUo0BAO+G5zvSWEZ2LQflmX3QDRg72z9Zxokto41sqqXgw== 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=GHBrn3WQf74ZkfOmgCt1XexJieU/u7v9XU3QWsuaYo0=; b=guf6VfFg5ZT7I9EOIPsnaG5aMTtFoB7Vm6jc0Z6ZVv2HCihu+6t5dYlD3tycYe+y3jwNoK3YK8o8J/jw6h/Q/wTe4szCKvsUj5DaEQJ70C3f472Th8O8d4QC9xZesdKBsvUxDsGyvh+RyvGjfQphqdgCR1quDRrvaY/V5sNfgJ0Ng9fcy2TSV1DQCXEF3s6EHmHOLT+E1P/RoH0hnnKBZ7UNMEVbQm2sp3+/9NCHO7cIIAC0TNpgHwGGzuZ6O3DzAVpoCph38V7YgDakd6kIN8w7m7r00kkFc92wXflsLuWrZVmOq184fxZA8t6chu2J75q0j8FmawEIp1qEnAvo9A== 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=GHBrn3WQf74ZkfOmgCt1XexJieU/u7v9XU3QWsuaYo0=; b=CvJkzwvJR+kZcis2CMbzmRdiAymSH40WMVZWaI/8GPLuZBwNPz++VLZuqfR28rZi/7z9Qd7E/2cHAZiOxq6r1dGbrVhvkpbJX34Iv5ZUl6o29+QgTB1jdyBKz20xOlascL5kJBvAmcDgIXbfrMFFJofoRKDTIbE3O+plFXNQDDk= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DS7PR10MB4909.namprd10.prod.outlook.com (2603:10b6:5:3b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.31; Fri, 16 Feb 2024 21:13:38 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::7eeb:3b3e:601:2e14%3]) with mapi id 15.20.7292.029; Fri, 16 Feb 2024 21:13:38 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, apopple@nvidia.com, Sidhartha Kumar Subject: [PATCH v2 6/6] mm/migrate_device: convert migrate_device_range() to folios Date: Fri, 16 Feb 2024 13:13:20 -0800 Message-ID: <20240216211320.222431-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240216211320.222431-1-sidhartha.kumar@oracle.com> References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR21CA0028.namprd21.prod.outlook.com (2603:10b6:a03:114::38) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DS7PR10MB4909:EE_ X-MS-Office365-Filtering-Correlation-Id: a80b552e-2cb2-49a6-3b5a-08dc2f3424a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qdF14UNC4iLwJhEPWWS3XiNv+USr1o10DZP68HSq4o9D5BZd/yWx2cO/mIdzQmeXHDSsH3lAZmKWsoFabjxBdhudC6CZW6q+T1rQkWFCt+w4QxJqCnI8Jmgvp2vflIXuWWyDlrEPeau6xIk85SMXMyH1cQ+8Pji57Km2QIb6/J8w4KPGA429lQr3idVNoXXi2BEt/7vsv9x+21S2C9x8KVBcy40TEkDHOdxSbAr0lS9HNHYjD6W+wXsRgXyIzjKPQ+zllcAXHCv1Ch4yprEoVwj72iM43ij/wg/c+9MdfX2nAkmZwUrsi5O42BbHvwq6LfeXuZJIRfkUB1kHkrMxUB3v3cMw01DjotnH248QCBgwwYfrhG2ijU93oPgrEb98ekv8TeZs+hrB3ELSuNKbVw63hBySqzXw+bNqqAXDpqibYchbtaV9uXNhdjyXn/0jJmwPSvuj79IeJDO47/lswufGlgL3TJ0epmCaepQqjjrgO53O62A6dlAKRemc1UbZ/UVsrJIrYEI7RfPBQsh6cRX1rtbM5kB7jTP4e/uIzyqYUsg96pCN9oA/nibK94jf 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:(13230031)(346002)(39860400002)(136003)(396003)(376002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(86362001)(36756003)(38100700002)(6486002)(41300700001)(6506007)(316002)(6666004)(478600001)(6512007)(83380400001)(2616005)(107886003)(1076003)(4326008)(5660300002)(8676002)(8936002)(4744005)(2906002)(66476007)(66946007)(44832011)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y0v4x7AcUELOXDmidVcRvKpAqyvtWiFqd6sv7DdPiFofAk4GVbisveEXLAJ7dMOea/odvvc+2cOvrD+LNcKbsTZl6GJ/Ubqzro2eF05WByRZkXmfsGrsugfegtagUdRVvsYDKO9UWPzmH/Kg3itUpn7u7+XLuyTlgX96mZg7TRWAJvb/gnbrr1gVvO/w4RKBb+R8DC4B+qecjuFsXr8TZ5zXTQRKnwQ8jZmBwZKEtWvwWmdvDM6WoKwlb+7V3OWqSE/CdIrBIKYDUcm+pJ4EzJjgspZSUKKgfCdPVMXqRj+3LQHLsMXMzsEVEHj6gnC+PVsWqFUreiIMnm+YQ8UQWbYXnzOCMTrQcPTei53/U4XzmDmqrzqGp8pOQEcsktYKvS3m0Oxz3lZRngHqG/RLP+JxbHX1baiJAGpn+DyP8QQNGJx0KP8QfyWOMWP8Ff/gaoOmLdRep8uddlmkOdqo5eGT6ww1ezvi8ASRucWewvHgWsOz9622fuQVIuLt8opDnih7OubqOvUDyD0ITD/QFgT9qOpbDA6een6d9YRgE8TEJRJNi8x3dItiWK1snR9bL1aMPaF/2nFKhGO/JxPpiPrFZQmRqrY8mxUTYKiMEcENp+cerM9PYdfV7g3G9aBtCihQl0dZbkXWLchI1prEvPqY6zR8J9Lqj1e9XGbOW4gnufC4AG3iVnujp7KDnxZWPDU11jEpCYtlo0AYeHwZsH2HG541EUx2MJim1SGWkPQaC/zq02r7OVKi/uyUPF84EU7z+f4kn19vE4Di5dCNnI2GYvt3Sy3vMgGgrk6e3F1qvEl4EAS2tEl/vhQQXWeIXhzm3PnjWNRzd51As8bvMeKTxgKfJNR5TXdFltK5cFu8dXiCz0NPdlXeTxt/MjXJzEhaugjHZrAUpH2snTpPMrYksnoSmXFivqg658Yni7Jddb7rNhpjNqgp7jwkSKSDoKEDi0Hg/jDjpO9aOwc7rrIbhp0XB3bCU9DjDxJI68xAzSAl90SfvuahZOoAAHBGh9oJVjeU6bPBbzwCQNmj8Q1mnRZVOkqNC3Ic9rNA3TxaXklWBSSkHQoibGo3CWjjjJLk5sf7YpC7QVv5oHaQJPhVVdZ+FmLFI9DILpHEygOQfYzuCTuRNqZj3dXP7JJ7IqA+sP4zYt8+wAQugK9Hn2UqunYl6CWbuSqvTvtTxvX6GBMRWaeKnxqhGUoTh1IHAWUxFfpFTV+k0ZlWWiAub9299nMw0XQxcrctSPBsWZGlU1QL6t2FQv12N8+lddw2ejGcnthRA67iTN+hDifF04cRmALi9BWjMzsGfrPJ4eiaPf4C+Bfvc8aT3Ahc6duaG7EnauI0DivO9QXEpoUbi3l2ZYi0WhfkuSXeJgkAN4tn0ki4NiTLD23NNAe1MzRZBHx7PcKpUbvtB8ax/bpFjudHb7EADiki1Klp8hi149yCriokPFmff5nFfKsASMacJG23YLJwGcDb7jEngx3zVQ4htAEOeq51rbTilZbqQPOlV+D3a6dWlXlmQN3emqzGm/yVqkN4Y15gITuau5xg/Mi8tOqA05v/kQ3pJDy5NoGPuz/OAfiuUVqoB/1lLeSrBPR2JVIPPZwcKUbhDaG4LWDDv48s4zg4noaMvoAjZiw= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RZ61GBIEoJ2uLaGmrKbnRiTfUoHhYGLCHiPoh0Z5GfjQxHNgbcjsRrzy9rl3y4TDvGyr7Zt4oGyEFwY14J7yizmcoN/3DtO0RrtS/cUu0siqeas17ULWWMSPKI6FneXJ3S8Zk12bnfWf+wpE6ULLiXJZQQ65HyQ/Sc2Cq4zeyVCMBaA4KKfEUyHeWVUZ1IC87/piwvDJ0iRXu+8MdDU7eNG0siLNtKbGvkuaChqiewel9s9bLZKQjEoEBlEmfV52L2Pl7FVWUGf3XdtAD5Z+MtlxVN76oe5H6bGCnp6Pgofn3K+br6CEDjUKI261Ucyeeo2mJ14tCTfV0rE/dCUFjNfvZoCjRghtuHx5im1p3ZCvlDpSQCJXMd/oHXeVJoxU8HcPttdrjsZ9+JrTsDEsHsc40s9n/8xubHv+tLVSEhtWfXuOq2KzrL22vcHqZ+AEK8J0bTILlNW9plHazKoQ2DLfmYYDA2SDUMQq7GuB+fKtbsv323RbPPVgKLUapsCv5d9zL+mpeFI//e37pFVlNSyNAobtp9AXgBILcnaZbbDqTVjDRUxOWVoVy+d980pjQbJzwegdKMF3ENjy1RFC1PRY15vDZlShhUKUKG1jQm8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a80b552e-2cb2-49a6-3b5a-08dc2f3424a2 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2024 21:13:38.0530 (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: ea1grRmPVkNyKloGVj6+nj8dY8Gt8OKuQWUKmAS2Lms0xskXr3VU1uQnUKsG8YFrm+U2XKINnVJvuyt63UUSGkylUASktt8GkYh4PR57a9o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4909 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_20,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160167 X-Proofpoint-ORIG-GUID: gt_se_bBm78GGJLXdfZeJ4TRBRua8Pnh X-Proofpoint-GUID: gt_se_bBm78GGJLXdfZeJ4TRBRua8Pnh X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791091648563265832 X-GMAIL-MSGID: 1791091648563265832 Use pfn_folio() to get a folio and use the folio equivalent page functions throughout migrate_device_range(). Signed-off-by: Sidhartha Kumar --- mm/migrate_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 5c239de0f08b2..0c8d86851e631 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -888,16 +888,16 @@ int migrate_device_range(unsigned long *src_pfns, unsigned long start, unsigned long i, pfn; for (pfn = start, i = 0; i < npages; pfn++, i++) { - struct page *page = pfn_to_page(pfn); + struct folio *folio = pfn_folio(pfn); - if (!get_page_unless_zero(page)) { + if (!folio_try_get(folio)) { src_pfns[i] = 0; continue; } - if (!trylock_page(page)) { + if (!folio_trylock(folio)) { src_pfns[i] = 0; - put_page(page); + folio_put(folio); continue; }