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: 13560696 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1025CC48260 for ; Fri, 16 Feb 2024 21:13:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6133A6B009C; Fri, 16 Feb 2024 16:13:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C09B6B009D; Fri, 16 Feb 2024 16:13:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43A4D6B009E; Fri, 16 Feb 2024 16:13:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 339F56B009C for ; Fri, 16 Feb 2024 16:13:39 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 01D8D40246 for ; Fri, 16 Feb 2024 21:13:38 +0000 (UTC) X-FDA: 81798918558.16.9DD934E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf03.hostedemail.com (Postfix) with ESMTP id D188420007 for ; Fri, 16 Feb 2024 21:13:35 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Gg9ReKux; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="zNK8/yhp"; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf03.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708118016; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=C7E1LFEFqRFsFhXCtqRYBbiVglsmTcGDBOTo3k+XP0U=; b=QYe0g3maW1WZ3Q88Ix5REvYYe7kfOUbjXNTT1vN5QPMUGCeZnhbOmY0hLNUR3cxlZyeNZ5 7XNOdvWAqDBFZCoON05broAe8T6XJv4fdkpe781bHLDbdAWBwLjxl/gxsVRoYtfNL4OPoN JaYnZ2kroVhhdH1W8JDw6kOgVcBE2RI= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Gg9ReKux; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="zNK8/yhp"; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf03.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1708118016; a=rsa-sha256; cv=pass; b=4eUyz7Vkzdmw3QjiuSdG+7KQl6N/LZQeSf6u2lSrXEkkgnt/+P3jQXy2hqn+XVbSsDmKBQ gdmPPESVDvzSBckKztaGxoFBwRdSIgtJ3ezpuc6WySqdCRbmfwS86TYoOQwuSYQCl9aTzl pmlVrRKYNcRGlZ3QdWne86Zn5FEKPdw= 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) 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+YQpKymL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MC/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-Rspamd-Queue-Id: D188420007 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 8qwqu4wmt9ymspcdo4p6ienz1jtwx8ks X-HE-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KhDU/5fAUFk9kKdxcfFPpoOkghvsHjIgHZB0qJ2+vrEl+bHvg/B8jA6+brjogV5d/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000041, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: 13560697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 609FAC48BF5 for ; Fri, 16 Feb 2024 21:13:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3ED86B009D; Fri, 16 Feb 2024 16:13:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CED796B009E; Fri, 16 Feb 2024 16:13:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA3416B009F; Fri, 16 Feb 2024 16:13:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 99E7E6B009D for ; Fri, 16 Feb 2024 16:13:40 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 492B4801D0 for ; Fri, 16 Feb 2024 21:13:40 +0000 (UTC) X-FDA: 81798918600.12.D84B99F Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf25.hostedemail.com (Postfix) with ESMTP id DBB52A0003 for ; Fri, 16 Feb 2024 21:13:36 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=YEX+IVx0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zRE5wfUm; spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1708118017; a=rsa-sha256; cv=pass; b=ijraI2ylhWS9PQ8PSeMuVZOaELxe25sK3oIHkbp6kZtGSeldrqO7bgNajKn+xdjEd0KmQ6 /5mN1/p9tIHTNn9wRG+SATP1QlCJuwsbjsyodWi8wUvo5PJJ9HwXZzEUW9gYnIsGUgahGk 1ivxzCIQmwITTxSzfGBKmdrLNV7R2Jo= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=YEX+IVx0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=zRE5wfUm; spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708118017; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6cEEqxrWSmhx+Ys7t65MJe6QuqR9ifBsjb7IcYbYUQY=; b=svldjh1YMmJRSTbqsz92FTy+0THw+dUS8h56QEKqYt2yxS0vv+adJcxXRTR8irXc3+Pf7x N59/BsNj7edG3CmKeSsG+5t1HNfHiR0JSBstZr2HeLeHjY/gFskmPxLle6s7/XXdq4WVVi P4l8c3Z2R6DdZ3EhDO+KtTxk/hA86OE= 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) 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+94mSqRLvPVgzc9THKHzEHTMCjqRtr2cBEwZ2FUcs3SS9ej4W5VZA45nSEojiOEggBgf82Bm7u1HF5HV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SKP0qHS0hpja7jDKB7xGkYGRadTlErd7gP4jViQpffslUXJ2JiHrlvv0eMxUDrMslMgVhaY37hionrpxsaBY/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-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DBB52A0003 X-Stat-Signature: i9ymd86pz9n6ksqnmyn6frc6w5qhf8ih X-Rspam-User: X-HE-Tag: 1708118016-594354 X-HE-Meta: U2FsdGVkX1/ZtNdoYth0wc1KKe85WiY5QWcblS6IVHYMk2olD6N/nH5n6EJ5zvHwcNfhzG5MTonXhIBArhtv+vM+RTP4VPE4elIMaDQlO6xrJY2Xc5VqW8tIKC6wFHSBD+OZnYIohuM9A8vBiIx6Kam3MF37zdr321x4CQwhH7ZlVbM6f/rhlTulL5UgDrWV7DbhKXru6yXXi9Ov9fgixoPL95wyUb9pMW7p78i44wPMDKLtRV8SM+3Zvb4PVRmNSDS8FKzTPCtg20rzP654ZwAXeaeytQQSTmico+z+ZtWxraROspgcxyD7Ao0BXJi35suvYhI6NB2avN0cJpobfSNc9GrcaQSf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5mYlqoYS7s+OlAZ9aq5ZsP5DsXjgTF/5QV6l4Turq2JNf2vTi+09ZFjcy0u0ecUj8PuN00DM1GCHQgvPFAZtvePsvwPxh0GscDeXJNY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: 13560698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAA9CC48BF3 for ; Fri, 16 Feb 2024 21:13:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28E806B00A0; Fri, 16 Feb 2024 16:13:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 23F256B00A1; Fri, 16 Feb 2024 16:13:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06C266B00A2; Fri, 16 Feb 2024 16:13:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E715E6B00A0 for ; Fri, 16 Feb 2024 16:13:45 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8740514014E for ; Fri, 16 Feb 2024 21:13:45 +0000 (UTC) X-FDA: 81798918810.16.9B5DE75 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 45C941A0012 for ; Fri, 16 Feb 2024 21:13:42 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=aHDUZdnZ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZSt1CDOS; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1708118022; a=rsa-sha256; cv=pass; b=AzIA5d6ilHAaTMoJjsC2kaYKYnlRHEm2pXPvEx5apHK5EYjUFvNZsmdPkuhpJgcvvfnKF2 J8INMEC543y0NknRnNpzEI0XbNP3wB0eK2z2sOjML7NPxEM7/MXs5v6Tks/LaPjWVWxXcR 0RTdN596ipVpC/inG4ZU8a2VPnSzj8g= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=aHDUZdnZ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZSt1CDOS; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708118022; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7PLIpgoX0WzBhOeTtr7m+MCiuzEgYeEYqWfbsIroNjY=; b=4ygO/rnVoXV5brEoCmxVSnUCjv4Jfzj6zaNxcLIlATzeuG/+AzjdxeVFRRQsKw1sjyGCh/ 8Rjr2a5LtfKVF0l6+HEOwfIoP9M8iOci26PfIk+semjPVvD0exFKRTh7FtF00Su+Psgn8G 3kgqfRP1uEZ44E+VaQwdiLWOc8VywtQ= 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) 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 45C941A0012 X-Stat-Signature: 57y4w94fcg7fefzkxgqqxufzkyet1bx8 X-HE-Tag: 1708118022-444829 X-HE-Meta: U2FsdGVkX1/Aeh3D06kGi/iaxCJ2APnf/iO3gVwaWf0o7c/4uf4/MhzTMKPtespQimwVvayvwtUjSmTe+LymN1/+MJRqzpF70GjkmV/gu/T2cY0M4zcTgLq31LqHj8WDeSRTi6ukgecmACUxvlI3vUoMj/r4lDFw5wLJ5fJOaAGSTSQxGail6XI/B7Beu0Xne8/HHQwKOITvk3WCsQjuLqTqj5p4VrLJLOL8YqNydxL+BVnYEEHddWvpc6jiMHk3xxmA1PP7ERSXhtaWgLpjxvx7wk7m2AJjOndkbUS3FGIqW1GCcnB+uUv7mbMiWWxrrubhhG2zV7ze0rItQBQPY2t0quIsZA0lC4pwGfWaMZ7xumnYfmUnFNVuyKH+1No6YUeeilxS0hKJ8dFS4xRuEgS3FZsPn5a9AavjWkmaRWjKH93XPSzObNtBnBga/TS+uX3TaQegNslTqduS+ANej8LX74fCrCZhJnmK4KrUYTUIoWIfUSlL5R+dRR6Fw4FHMI+hhNV5fFdTsjU0KLB5o/Zu6XlWHSbdYcHGmVbojMPBXuY9zgnfU8CELZUuwYZ8CCdsoFax5q6uwKG3kiEn6aMzer0qvK0Qa1VhYiQhVlEXZ+QLFqLaEEBTeDzch3Ju0bUJ9ZQj9ouMCmi92AGC1RfgIelwHIOXj3j7bPm0RraYQT8EaA8wzlDt85FZ9XXUuneS30EOSMZoLEs/ak7OyxhhApOiU3hFp6bdJ/2ETZWRqcjbXqZ/P95MN81k2lV8F6y5K1tpoyhzhnSNYYFaDKZT1DcO8CPzwo/rvq98NeCrFMc0K3G1TkWgmE28QUXVHzlMLrWjDJhSN65R9H5jsUbeNeWLLs39JTh6knE/ExyWkDsNRjGFnDvqbg3fxeaUOY+nGOLWrbmvL8IoSDRBReTI40hT0t6EtYcztLfCHqJYEFhKR7aTczWEUGshSEpV/Qkfe68DyGNW6eJZiOm OOqEivTk c1Jp8p+kKdACUt9W9iRC4VOoR5pXvdeUuZhn24m6pdm0dUv62eTRWq3DqZiV1oR5Vf5+nQHP1jhJJpjb8XWrRDVBa+2Qk8CCy6kb+4Y4u1taH863OG1xQ/5+NXIGeqsSl5o5JDYj6Sk0ari87z28prLTkq0cHB2vZug8oMkDYoB8xScNiQBkvgF2w/y/Un8TcgPDLAOVlH/JkJOWl/uhqEPHGoTsLYXV+OP4Wf59CkebyjdFvUVDPWiAozI8fqYVsp3mespEX8tIewtyxP9sDFCIm7wu3gCFYlSYyYf+K5Sct2gY9ht8YfFXeitErhqztHdCO4th98H/mgze19ZzImW5n0b4aKh4FPvStuefAkOwnkQXSH68TfiforWqcGyHtz1emvcxGUAgIemhQ9OtKCtccjTpq55fxxmnDyS6AenyXOxeYEjIheaEoB2L/NQpKHNGJprmbFmK0/MwrJUXWjOIvfIF0dacDNnwy9FOZzF+7jMdUbvJeniKvaB8Z/BgHm8otsuAqUi5cOm8ZqjxXoygXbAW+4dMYB+lBC5eop/a2Xx0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: 13560701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCC6FC48260 for ; Fri, 16 Feb 2024 21:13:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 353646B00AC; Fri, 16 Feb 2024 16:13:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 301626B00AD; Fri, 16 Feb 2024 16:13:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12E026B00AE; Fri, 16 Feb 2024 16:13:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F37416B00AC for ; Fri, 16 Feb 2024 16:13:55 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AE2D580249 for ; Fri, 16 Feb 2024 21:13:55 +0000 (UTC) X-FDA: 81798919230.20.4BCFB60 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 6AD08180015 for ; Fri, 16 Feb 2024 21:13:52 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=SvJaCzwu; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CbBw1b2n; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf16.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708118032; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Zyj5W/hf5fQSEZwMGqMHlWaHWhn7dkZCnmqh3nzq8a0=; b=IxtoXRxt6Ir1/7Zq/kWFiPosdJF8enoEeQVlEBpArrz36Vqs0Xjizd8WBzVPiGe3TlLz4Y Xj1cnhLb+2WKNYJwfVMNPXROTi2fQVbLpsCcXFX5sqxb3r2NphyJYtbtdN+Ifdc7ZVI38i r77TNAv515J2UJ3kF6MJF/cySpgT1YE= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=SvJaCzwu; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CbBw1b2n; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf16.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1708118032; a=rsa-sha256; cv=pass; b=PrGVHDo9mEr2Zfl0dzoukbVYFtw3PYEskGEsY3JWsQGV64vVZD8iCiXKO9M4KrdrXLEKeB 0qDm+1cmKtGzFSfUYlihEcAU3W2GveCMZcZq6z0USoHIYxopxqetf2//tTSbqHjct/vM9Z taw6V+dUCof6mlBaEw3mfr5qy2COid8= 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) 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+aL1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Uhu+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-Rspamd-Queue-Id: 6AD08180015 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ugxb5yd1wokmrdrbwkfxdt79xhkjtfkz X-HE-Tag: 1708118032-541295 X-HE-Meta: U2FsdGVkX1+r8Mpy+SYQrUkhaLElbqqFrC+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oD3QG4g+kKPLNLH2ZmhDa257Kt0L0PDTyaafkklrzmOxBBBmwUAFPZkMC3nVh2QVdNF7zC2bPHmC7+FCpjgR89wlbmWH9kq0ooTxsVhSDPHKzAuhx3Q5JNx9m8AEyXGVZjmLx6GasE0nyi11iXip/+lSheYNJ/eHzfbkr70HJIGusVKm7+oujNpcoabgqeRa+qib+QT1XwRpoQuNYrmyz9JEjKuBBEHyobOK+TWk6q4oRvoCbYkv7IMmTMWl2wAyZ6cCxKeJUixe/u0O5fa5gEgKewwu4uLUa6A8JDqDq5OR8aKvXi+JCfJcley/kMkQ9x4Gz3poK3zJblGqJy9c3LrojIFSrusrVK6eEviMwThEJQkJlGBdXDkDyvxySC+Tx1NvFe+Nni6vTwFQSQif2XtZs2IOovfDxwvB9uaxfSYto3cl4bDYYCeD9ssA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: 13560699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF2C2C48260 for ; Fri, 16 Feb 2024 21:13:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E55096B00A1; Fri, 16 Feb 2024 16:13:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1F86B00A2; Fri, 16 Feb 2024 16:13:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B698C6B00A5; Fri, 16 Feb 2024 16:13:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A18A36B00A1 for ; Fri, 16 Feb 2024 16:13:46 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 71C2840196 for ; Fri, 16 Feb 2024 21:13:46 +0000 (UTC) X-FDA: 81798918852.07.5312382 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf17.hostedemail.com (Postfix) with ESMTP id 5D75C4000F for ; Fri, 16 Feb 2024 21:13:43 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=kdPOxaJR; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ib9k5B9A; spf=pass (imf17.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708118023; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PULTjpQ4CgKFl7QQYFQWEw7UCRXWWaoj/fracxY/qoc=; b=f6voXlfW5xLhFFK+89FcZTkPVIgZzh01Krn01f6Xg2TNSD9lv0tcjTihskJiAkWw7rNQyO ifgL42zQ2a0fzVAtRXnMIZ5yW/Gw7K37EuZ/fGhRnOTRzOPUFIvzi9LTWWaritoYqjAO4d 70kJNAZmiioWCrvof6EFcgh3NEPKej8= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1708118023; a=rsa-sha256; cv=pass; b=cYwHg/W9RBjm18Zz/kngEjYyU4uoAA+AxgvF78HkVDe1UsPbN9HFw05J2kAsEP0zcS3v1Y R2zwv9VaXgd2HmW2l2KZsJxS6ibAgyJi4JQP19o8IIPlGGbn19PskkYCY+LJMSq3HMidXi jjytQ0H19uVrBmFs2jWEkhsPn6MuEKg= ARC-Authentication-Results: i=2; imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=kdPOxaJR; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ib9k5B9A; spf=pass (imf17.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") 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) 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/amBcloPsCGb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= 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-Rspamd-Queue-Id: 5D75C4000F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: tiqox6oufcojrswkmnwjj4ifxxabigtg X-HE-Tag: 1708118023-169425 X-HE-Meta: U2FsdGVkX1/EIl3k5NJsdhakkjtxjFb70ys2Z+yCV770PvKSiDz7Fxr2DqKUDSPHStyeUWBxIS6fX8jCBlCQIjmYf39/G3Q+DVQhL73FTZ+oHCBI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PJ56m/7c/xjL9Uul1GoR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: 13560700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 172F2C48BF5 for ; Fri, 16 Feb 2024 21:13:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDE946B00A5; Fri, 16 Feb 2024 16:13:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B8E4B6B00A6; Fri, 16 Feb 2024 16:13:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 992376B00A7; Fri, 16 Feb 2024 16:13:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 844336B00A5 for ; Fri, 16 Feb 2024 16:13:47 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5E7E116016C for ; Fri, 16 Feb 2024 21:13:47 +0000 (UTC) X-FDA: 81798918894.08.8E976EB Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf02.hostedemail.com (Postfix) with ESMTP id F393F80013 for ; Fri, 16 Feb 2024 21:13:43 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="JG7/bw9J"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CvJkzwvJ; spf=pass (imf02.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708118024; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GHBrn3WQf74ZkfOmgCt1XexJieU/u7v9XU3QWsuaYo0=; b=M5w7BbzRdN0Hl7AGKHxsu0UyIn3mvxFEnstwNZv0mhgFm7kxuQmcKOwgbLDeL360IscIKv GstyYKByqiHkwSDlXOV6aKvfgxORo25+zT+6d7dNeDt9FAlx//8fmg6TuaZr2oMTvv7QnA n2al0Veo4fvnNuvG/sEVX1fAWuxujZU= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1708118024; a=rsa-sha256; cv=pass; b=oCpYi4c07J7hSLg1+NvuUuBsuG5GhLjoJRLEl9sgNu2XFcERADHmyz/Z8PNXCZWX9kHqVg eiV5/Cr7XZTWiAWbPx3xhOoP5UNQPyOsCLg3aOWJTMB9SSFpVtRHCVYzOEPPJh7lL7SeD6 0A9WdbFLMTJot5S5WUSyxuq0XMVc01I= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="JG7/bw9J"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CvJkzwvJ; spf=pass (imf02.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") 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) 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+cerM9PYdfV7g3G9aBtCihQl0dZb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oJ2uLaGmrKbnRiTfUoHhYGLCHiPoh0Z5GfjQxHNgbcjsRrzy9rl3y4TDvGyr7Zt4oGyEFwY14J7yizmcoN/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-Rspamd-Queue-Id: F393F80013 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 9qs9179z4tgm6wzdd9rqts9q6bxaz9ki X-HE-Tag: 1708118023-373237 X-HE-Meta: U2FsdGVkX1/tq+/68XSFpT9YRNFeHBbZYpKdg78e+kZ13+Z2L7dgILhOkjzbwrXYjXJeo9+HBiiL3uQd7rfS5v0xGpIHvn2iatKttSP3dDDCkQMmzbn2j/4j37/0vtbfSJj+2Y1ey056p0fB3zkSrEqbThX0+ljWBVUDZxMmeYdy4stt+5wJKRFy8uiDvG+clGjaMvamiNMZoa+YH0mGmROVX9zA55h/BvywGES9eLjBkLC3wIHUPPxeIzgZfW6D1gQ3T5ENqkcAcVP4ekTzVHKIitn2QEMRcvKIX/T/KnezSHuAbSb0x4TmTXh9oo1upOOLNyvVXAf82LvfERRCi4c2aVVqWwOh4XUtLdFVe8m2RuD3oKX2lKJyXK+AhohlZebHm/2DLkHkM6Sbg5wwAGA8d3OX3/zcbqW1gC0EtVnwCAdMiHvNOMPAoTLBzGc1zjOE1lh+paU5u/fWi4RjcOyfRL13Slf0c16/SSUR68h8tqXyKXGvnM+7v/uZGuEdGVCO+NfSQN5hVn16oypu8K6V5x27v7LTyPLzHZLjRkn52Tp4xx2Kv1G+b22+MP9r+y8XVv4J81QSFweXNBUnfbmQXlgqNNdAKpHDIZdDMhyodq3iaM+QMdj6ZvYGQTSXwgwRfymvokS1YkS0WJT/5dLUQye8tTkXeGXJPoPmh9u7Bo1ey9gl/McWN1CP6/sqtlfQ+NV4xeU7Zdhz5FXENW1lLwAeuqCWdA1UPKo/BlTMRK63O+xVPZI9BlEZ22rQRA3XdkUcm44F0gcs11DSj/Lfmkdt77UatTFXWC4p7pSjsmLAveBZxnT/2f+CqNOysKRYX/Hmd8H/IO1jitS+z4+qSdTu8hvedBgrWqIkaIlmOKU1kZg/gLstn13BprmpkOG6bjiER8GX3VNKWnVU+rpjJ6ZB0EJm6vne1Bqxi3MM5bti61A9TQWb7ehBFFG+IWnuAIjROqvkKioQo0w 1WcVN8QN oo26h+otbS6UuH0DXpS6ISeYmGwUEyu4p6Im+Pkn+FbvGoitMPWnAUnXYP2NG5tCgzl6zVmlYN932OXvSOGBK2v8Og6EKC5V3jatjD1ZQ4AilYieMEr3spOQTjtSDADMlrxBx+BcYZphzJ6W0GgaYBELoAPRDFl18vic+Ci8ZLklOX0FuJJ715fSEf4oRy/Baa3I2kIjGauJq2GGUAsx1hxHu95LV7lIOwMB1yzfWhIw8+8hZhVe8WT0ZdRWHnVZnmQ1PeZlAKDItQI8pbNPcoqP2FnbchzJ0HP7yqogpe1SGNV4n6ofSjlD6h7BJIx1NWNfLS2IrGOwyftT2rdc8gfND728YMDSzsvO5sa3bE2rSPqfrPDoAyRtRNhlAFOmbqXsm0YFIj8kNgmejMxGkiu0zphSvDWkWzcx/xJyZ0gL/Y/8zzwqlNpsfNqjyA8wrrV3o2uYy70Wo1Qg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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; }