From patchwork Thu Aug 25 01:49:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 12954133 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 695F5C3F6B0 for ; Thu, 25 Aug 2022 01:49:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D79456B0074; Wed, 24 Aug 2022 21:49:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D28EB6B0075; Wed, 24 Aug 2022 21:49:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCD2B940007; Wed, 24 Aug 2022 21:49:22 -0400 (EDT) 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 AD88D6B0074 for ; Wed, 24 Aug 2022 21:49:22 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6CEAAAB2F8 for ; Thu, 25 Aug 2022 01:49:22 +0000 (UTC) X-FDA: 79836432564.02.BE76A33 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by imf29.hostedemail.com (Postfix) with ESMTP id E923712006C for ; Thu, 25 Aug 2022 01:49:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QKmbgJUhS20z1D9fLh//EckbcYWiJCsLlZPx2Mq2jfPqwrDQILCNqBR/Ira/AA2owvEE2D7sSOIoXvPyiO8n+lZesHDNBbEuEbepPVMOPOV6larp85sgYTI1ju8ybwqVbvnDZOv40fc+d5Mu8O6afZPazdygWxIZ/QqL8y7TwBqrQ+GCifj15k2upfgsm6udljURrrJJHm241rybrGqTfDdLuDclDjS+KdJv1x5iaFZzBI4/D5EQI5hI95DxJgNJTobvzrqP2CfPBYgv2RKWWbmLYLIVufi59Neak7c861busT/caqe6WOyPHIwDNswdLaasEg/NPaTnLuIelTeKmg== 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=f/bFN0f8F1UYnSqChAMwiMRIob1WjC5rcJPp/uedTRc=; b=jD+y4/XiQMb6ejlHYA/7RufAABz2b6R+M1m4mHGGEi+QM/DOf4mv47olfC1VFw7vvcdMFyHutIoYLqH66glypYQSMjkjlehJjmFobxdHqur8kvnsFtnPkrGL1C1R6fTX9I0ET5BAhSfv+oXQWqjtql4qIpN+zWKJs6nmbDXkReFs1+Gzp3usnyWOf/c4HdAeIp7h9AwuGrrsn5RvjF408tdBlmHMIUyvdzT9Vwt6iz/kKmwg8jWVDO3H5Q7MK/SqsDSB64WseAzuncenM9tEQKFVNy3fKWhK+ikM9TiMo5a6VHnezTd1TVCMTuMcvuH4AJqp/I4GuElVsXLlFjwgWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f/bFN0f8F1UYnSqChAMwiMRIob1WjC5rcJPp/uedTRc=; b=PXmMDJpjexD+Bx9//6dS6xNHsaz4coa6WmYaUwadcgxEV97GTtzEITwAyTrrDpVTlk2MQAtVje3mqFp+g0kTYkvb275wqYRL0chq01L35A8vfiMqgKcO54KoK/mMd/i11WQ86PRiz/dDFTNRPYMZE533UFbgyLicRDv4LeMn6PWpm2g7dyr3zgN0U4V2EJ+2ZgYHZOCLpAV8G3g3eBVjhttM45HRbYF1OKjVh8JM6AiYWlv5ot57z5Il1dhzoelLxO/jStfNdyeqeotFT1ORaUQxQNILXYYxBYiNUdeQEgNHKyEsOVOy2vyp/XMeL6Avxsc3yFwWR0Xso7MfFPN6iQ== Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by DM6PR12MB4747.namprd12.prod.outlook.com (2603:10b6:5:30::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Thu, 25 Aug 2022 01:49:19 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::7432:2749:aa27:722c]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::7432:2749:aa27:722c%7]) with mapi id 15.20.5546.022; Thu, 25 Aug 2022 01:49:19 +0000 From: Alistair Popple To: linux-mm@kvack.org, Andrew Morton Cc: peterx@redat.com, John Hubbard , Ralph Campbell , Alistair Popple , Peter Xu Subject: [PATCH] mm/migrate_device.c: Fix a misleading and out-dated comment Date: Thu, 25 Aug 2022 11:49:05 +1000 Message-Id: <20220825014905.977168-1-apopple@nvidia.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: BYAPR08CA0010.namprd08.prod.outlook.com (2603:10b6:a03:100::23) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9d02c9b-513a-4952-db4f-08da863c0663 X-MS-TrafficTypeDiagnostic: DM6PR12MB4747:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6nJyMzXmTVlv8KDp+Bp9TGY0gUz5uX5Fd3XFQkVVYzC8Gw5fuu2EoOPxaI0qxk1YocU/wWhwhuCW6M3WnzfEiZ2Ae2kemjV6Qgtf4YOTW79oaZcIwDUYuTW3Y/83Z64E1rZCYsb91RtywTtb2XHNBrWRXXfn9brsM93y8sUgVtSLBpF9QKxzp0NspSOEGB+fss1tdzFYsp+Gcf1m4WVSdHzAwzVLelkKJxQ9Q8cu+5OOXdiR9c+PONi6+BASv5islXEjFqKjg0WKQwsrFu8SilVuKB+p5BVMbk6xZzcU1VFbT1cqJQOajKd9f3pORP3W7xlql2dSz9HExIpZjyqOnchyVRJjdXoll2Zn/2fmCZoBS1lF5C0SBFdc9mRIbcl+2dJzYYdpX+gCqoRzYAtG0Cd3R7H5MdmFkbKhyCnsvZeFHZlSuzUMAXgP/Dlb2BtIhjbropPZMmI4J+KGfX9LZkdrD7IgablQ0+yuyKPmK68ta+XnTUHLL5Htqohc1zYls1EFg8jKRSboUlFRohG0C3H6hJga6diHVtTEqB+tTzsMDNdPQwFTVC8FYIVcDWRltu6udiaUremau5vrxrPfLyXb0knVDZ2tP+3viHgWCQbHg0RlDnEopMRivjy/feeHhug2OY48M9ZtWENyvX5LW3wkGxR7spj9HtVmzfdKNoUkT9Z1MuaSf+sS/BKHmZAOjNC8c5y31M1R4jmzbc2UqQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3176.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(396003)(136003)(39860400002)(366004)(346002)(8936002)(4326008)(316002)(5660300002)(6512007)(26005)(6916009)(66556008)(54906003)(66476007)(36756003)(8676002)(66946007)(6506007)(38100700002)(2906002)(186003)(2616005)(83380400001)(6666004)(86362001)(41300700001)(6486002)(478600001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-Message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hKjP3ceJzRqJOxGsP5HfmvX/hPvGD7H+blTSIqf780dXVwZ9hzkFGEIlDLISPs9nbQhczeVP9gD65QeU2CLt+/e/Kqwuk8Ctr2VW0kIpMSp2CePrtW3pDAQwrJgDqJRniejYwwKMxUth1HriuQSZMbdgg5fedV3njqbjx/Z/TJ4aDJ7mWubMWIMvbCTqPaL0VJd2BXByA/0GMcJbYzHhNmPNcvC5eo9eFhvNHimuMykdGc/Yj+OpJfQNWWJi8hw4Gq3qnF+BZOWeE1b5lVR376/kG7nIItFxJ1hLQkqW0EqjwhzTp1esHyZif6Hdq2Z4tLg5aeG0tG0Cw+eJFgZxMF0wi4IbYCGmtuinCTeI+vO5VWx/dpBwV572QYJsLYfNlXuxKaoM4FfW1RlAkdZvCO+dzPDyGvmSSwbBZdLqtnqqmEkS27zjN+bNiGCOn/B6ya6PHfinEw96NaxYjBisgvAurhAqAWHQPQizBMc41tLW1LKlV5IhQDEMx7rmnHGeZR0PYciB4ksXnTE32ioaQNExSHiMTDlBNWKnQxAt X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9d02c9b-513a-4952-db4f-08da863c0663 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 01:49:19.1276 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vS4zjcDrYJvE7o5eSg9xnI9Tlj7x4gnPfffUXH99TjV0MDI8vp3xk5n7ANzupxWD/nfL+cLASVNn1Fa4MPYyqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4747 ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661392162; 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=f/bFN0f8F1UYnSqChAMwiMRIob1WjC5rcJPp/uedTRc=; b=vz00Uiy4FZN6QvYyT4qz366eZ+ghjJ5MejZMOZZatVew5mriZfG92kVZMp+gWMRhpdYM5b ecnRDcctHMikevzdz3aYuQqjd5Zo1DgR9JthUiiEfcNR5ylQNMo9yZgZ+eP5z+R22JnI/a 9SAHAU/1U2gXY2wnNyaro1gzY9GIrco= ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=PXmMDJpj; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of apopple@nvidia.com designates 40.107.237.62 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1661392162; a=rsa-sha256; cv=pass; b=q/MjwOBUWdrcxXZ0u+lkIvAeMjwbVHWFMENLHL9KmIU3TYLj049oTPXrKDogwlSctKPysS 0tTalC/volqmwHzg1SsUBTww3d687eYcjvYTQ4gb/jboIsHifH0iG6Wcdh7PVqNzaKqQ0u ZpQWZvI3hHcp4v+qORzq81R8+8azNoY= X-Rspam-User: X-Rspamd-Queue-Id: E923712006C X-Stat-Signature: 7up5tjq3yder3uogsq9pba7jybozndnn Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=PXmMDJpj; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of apopple@nvidia.com designates 40.107.237.62 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com X-Rspamd-Server: rspam09 X-HE-Tag: 1661392161-675650 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: Commit ab09243aa95a ("mm/migrate.c: remove MIGRATE_PFN_LOCKED") changed the way trylock_page() in migrate_vma_collect_pmd() works without updating the comment. Reword the comment to be less misleading and a better reflection of what happens. Signed-off-by: Alistair Popple Reported-by: Peter Xu Fixes: ab09243aa95a ("mm/migrate.c: remove MIGRATE_PFN_LOCKED") --- mm/migrate_device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 5052093d0262..0736f846de0b 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -179,9 +179,11 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, get_page(page); /* - * Optimize for the common case where page is only mapped once - * in one process. If we can lock the page, then we can safely - * set up a special migration page table entry now. + * If we can't lock the page we can't migrate it. If we can it's + * safe to set up a migration entry now. In the common case + * where the page is mapped once in a single process setting up + * the migration entry now is an optimisation to avoid walking + * the rmap later with try_to_migrate(). */ if (trylock_page(page)) { bool anon_exclusive;