From patchwork Fri Sep 2 00:35:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 12963468 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 89736ECAAD3 for ; Fri, 2 Sep 2022 00:36:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 253508D000B; Thu, 1 Sep 2022 20:36:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DC1C8D0001; Thu, 1 Sep 2022 20:36:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 007258D000B; Thu, 1 Sep 2022 20:36:30 -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 E0E9F8D0001 for ; Thu, 1 Sep 2022 20:36:30 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BE3411A05DE for ; Fri, 2 Sep 2022 00:36:30 +0000 (UTC) X-FDA: 79865279340.03.DF37A92 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2072.outbound.protection.outlook.com [40.107.223.72]) by imf06.hostedemail.com (Postfix) with ESMTP id 4DCD6180042 for ; Fri, 2 Sep 2022 00:36:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HPjy/YOSM4krJjxO3w1/EglK30Cq/Ngf51FwvzNnWoiyE2T3DGXnMgmOsqVaq3W2w+YpEIXBev0bjvDW052PqBklXzTzyusKNNL9oHzUSOJzHApktO4sd2j7PLYeXt4F2pv+5F6NuYKpLF2oq4oMAeT94mN9RyZIYhOpiK4XIvgsRHWjYlrL2B3nkJsZVM1pM/oPgF0lLz0heHnSNNFC4KqYiXbQrHYtRB5ECQtDLhjRe1lJR81Wt+1GZnp5DoicB/yCvzHkpvbxBs23WCZef0Q15qriX09s2ZcKJ5g0L+dErziU1n0F7Sc5/TC2Oj4EteIepT5KHk7tIEALyG2KJQ== 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=mBq7JTG8UcLfh2/v7e/GA0COLHpr5d4BKHxKbsKdJWY=; b=NEladrlR2qzjwcHS/WlO3VQXyAeVFLGM8BGZYq/MHKN6bG+xvwAlMnQ0tvPp8da1lQKib0d4BAWXd6j4AtlqWb5YN1C58RfVP73lVAgF8xCkXiAY4fw8+nhgHqNd+oCB9FhoBBdI6CHH6nI9KUhdKT8PH0QKfgRBpcwm8HperzqmSQF4tvRhNvsGr0SaOJHZYcyK99SgLlUFitBs05X4BmcEE1FK6ZJrz1cpkIh6Lc65CL/7N5pSYee2jHIirB5NGd0ofBuFuvjShYQaehcW9euKTkGCdRvJp3MfwVSGUOEgwRppfjznvpufUEDDI870B5rp5BpUGJuavAzHnemVbw== 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=mBq7JTG8UcLfh2/v7e/GA0COLHpr5d4BKHxKbsKdJWY=; b=mDDhRsyAv5BeFKpCGuvg1hSydXNrVviq1v9hovieaAney46FD/ZHPOHc5XHtxags7FgnH1Ouaqhdbipw0ZwQpKgoUOVJBVe1UbFKJ+0sBFMKKImULJpKMmRlnB1Lb46BfuGBpggWM+vD/fn7nLa8ttmh8cHpaEtigHXEcpspyoNuRwgmZzJGPLn4dnkXJ6p3wBWpEkLRGcHnEX0GIunH1nbqNgQS+wKZXVeJXM4tmOhaft9ApEHElQOKNtH0Z6cgENkDLSWr/9wpwqL5f9e1TODS3cI5FZfIEN9MiKAywpmxQg0fIUgHe6CA1du9qz52BK21J47FEmVQBcmvXr0yMw== Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by DM4PR12MB5086.namprd12.prod.outlook.com (2603:10b6:5:389::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Fri, 2 Sep 2022 00:36:28 +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.5566.021; Fri, 2 Sep 2022 00:36:28 +0000 From: Alistair Popple To: linux-mm@kvack.org, akpm@linux-foundation.org Cc: Peter Xu , Nadav Amit , Alistair Popple , huang ying , LKML , "Sierra Guiza, Alejandro (Alex)" , Felix Kuehling , Jason Gunthorpe , John Hubbard , David Hildenbrand , Ralph Campbell , Matthew Wilcox , Karol Herbst , Lyude Paul , Ben Skeggs , Logan Gunthorpe , paulus@ozlabs.org, linuxppc-dev@lists.ozlabs.org, stable@vger.kernel.org Subject: [PATCH v4 2/4] mm/migrate_device.c: Add missing flush_cache_page() Date: Fri, 2 Sep 2022 10:35:52 +1000 Message-Id: <5676f30436ab71d1a587ac73f835ed8bd2113ff5.1662078528.git-series.apopple@nvidia.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <9f801e9d8d830408f2ca27821f606e09aa856899.1662078528.git-series.apopple@nvidia.com> References: <9f801e9d8d830408f2ca27821f606e09aa856899.1662078528.git-series.apopple@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0138.namprd03.prod.outlook.com (2603:10b6:a03:33c::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: 490f612b-ec56-46fc-cd5d-08da8c7b2c6b X-MS-TrafficTypeDiagnostic: DM4PR12MB5086:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: svMKKubL4qq1pI5f17ewmn6YTLoyd/xR4UXUuo3MIs8fpU00cQi8E0RaUtX2sMpEd3vTXmi6vXVaCtKlCCfuL2Oh1amT4CAvhoFE0X/yxnsuqjB+cqefS3Tb9dFhnWYYEfwdCmhvrYY67295nSv1DyaMUKX7Iq398/KZhrCIlYt4fU5dHLozLzvAgOhEwk8/UqYOs7cK+sV5EhC13hjula0AYlGe4slBIWganW4dFZtz3rG4bpOLaMic/RXuKfDgvstteOU/tm1XXqLGqXaJ2VRU6BHPRQ+symCSG9Ti7Z81B88sCGxW1sbBYLxZ69mE9WRN7GGIPAs5nMSGqtpFZgiSDzvOMM1e1wbd8mJXAcss1YNM7FiOEa8MpweJbuaoBgnWUDH3OwfJy7iSoJPdUvybi701LkLkFUkEcnsBaZ0fLSdl8efOPahQPIp+KWpjW9wxjZqSeUZSxXNL4kCsmekX95sJvzBwh4yr4LIuqelkqnXpZblggorOlgmxNODbebpMqgyKdgODW2G7r3AXEjoPQ8pkmkkLmdw97pSZ6ExMfY/ksCktiYF/HtDUMmyC8dF7UjNbQYzKtVW0Y6p4OP/LWF2aoS+LHRxwRsQLtznEXb4Ks2pLfdCbJg7jR/gfKjsA3ekQivG7WP4Mug8+qdWkTRHdUMOQXk5TG8ZuqoaBDdE2ZvEDugAulgj5A12bHutxORaGYhk1EZ0MpzKfVg== 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)(366004)(376002)(346002)(39860400002)(396003)(136003)(83380400001)(38100700002)(66556008)(66946007)(66476007)(8676002)(4326008)(54906003)(316002)(2906002)(7416002)(4744005)(8936002)(5660300002)(6506007)(6512007)(26005)(186003)(2616005)(478600001)(41300700001)(6666004)(6486002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 236XCLhMfKzBKE+M4Vk88cHmtZs7H9OBEE6zxBZwSRUm9hX5ZwXnoUvoDMf4sQHeig5A0d3D1zRbs5oow52t56gLkkMG9Tn0P8vAU+SdY5vOrZSYuvDftCjQYWAzIzkF48a7k9n4wGemZsMeCT080tVQ9rO60nu75+BPuFtPzBTx3L1WwgbhDCAmwiGSnvjZFjctlrxqsf92kFooAJ5if3638gDP8C4yQyjueB4S9MWEaO7olmWTaRshCQ1Sh5MjOdO/0qCoR+wObVsIE7Fs4pB+rCeqLMRIQMjTgOHF2HQWh9Ep+ztBcLvkytS7ABwVjSOY7PUtQhjf2Rme0xuLXfSGWiEUpJyFqx5OanqiCs8BDIOnx2oHt5OR4CzAZv1Fz6gGp8ApCW77WA5j5Zv+lSjsYuOgkQYAf0slSbajbxYLefG9ZeSg2YZ3QKg3B8r0p8A8qpctdufr1ewqPpoZ74GYLnrWlIX3ZOhmuBm7YS3Q8T887Cdcca3AixrL5/FyllVQ+545vx4vgldbDW3EAzOOa2aJgd/0JiTZKO8A7OTtdPpFB2VbsyBm2/ZYrgCSTAz87J1s/vI/TwfBJy3TxZJBgLcIxQBZRGYNXG0IJ3yTG4iqNQPKVKJtWDs4KE9O7h+IsUK9Lto+sO5tuhvWrp9HA6B2aw/WduPJGLtRtNBoR2iFPcgpUiT9qwqcum/cNmSJ05MOVCUjLwvxL7ivI/nJF/ezyGs17uPJtUN6IsF+obT5wOtLxVzyNxIGyU9pCy3caNKr0AzFgMDVn3k06GivZm5i4d/tAmgnqzEMuuMVFwWVc+kbuPqQOYKPZvxXMdL5gXF5zTKP2VkBhwS/xYm3qGBWzu/jLYvQ2kCg6HydexVTqGlhXrUE5kKmJRE9npQq0N/wKoEKpimKFSCfm0uXM14bJAydi0qYHjAfmb1w5RdhKZ6Y3voyscbbzbq73fylpiinMuDkVo8CJMcsnBXYTbzhTCSzKjZpcUbQydDztbsgLzJ1ktlLQTckk2HUoXsK7KxFCG3vFaoMX9Ixbisq9zBEla0sZLjsxB/o5yRta6QeN8ZTXMB6xB/SWgkwTTFQ4vqsnjareu8bqRG0d1RNYVd1g1qT9TCY+rZdulLrV6IkBMkPuejXGNZr5WM3Dp56iIQIrJRhEmEcUfVBl6vz6MIlbi6CXIi417WVo0I8MBTKlDT/uVzYIrkLWZ/gLrE9M5270HDwnJW4J5P9eZPnfV5jZOUbepaQkzHfJdW7kQWuuJPucYxjgxo+N9ehI8sez6YojKuazHImnPHVj67zm0Hpmdk0KdN4nrwILKeUr7UfNZ6f2p4szDQKNUIvxZrHqdJ9GcZHI9fNx2+aqNqOxyIRGqdV9FJKn4N4TSeDDYGsUsKRRhq+Psg5zsyj3kpv+w/hjH98ZrpweQPgbggkm0pimhzAuoE7VsSyP9Ne3RWfz5tYUD6mOOxPsYPoNfSxn6hRuWGJJqn848URBjPagHzFN4mBbOyQGR74djd88Q6weqNxQvvj+ylNPxFjCMffjdqtErMOe9s5wgWrdDh5cQMVmmbpBhWGJ9Yue7w5gM8mONuoT+LRZqmru+/Z X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 490f612b-ec56-46fc-cd5d-08da8c7b2c6b X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 00:36:28.1881 (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: XPqO3ZNFmxVy8krYKt2oNJSeakaO/db5aSVpR7Qq6pW6b0mjEIjzZiDcUgcLZrdvkoaeveSLVsAIW3H72CXMwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5086 ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662078990; 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=mBq7JTG8UcLfh2/v7e/GA0COLHpr5d4BKHxKbsKdJWY=; b=FaJ0kVfMV/LDdroZE4UTAdcg6vNyHI1X1LkILq0twF3O9fuXjsGRy5O5TlBnZMBsvnOzev tsTASS94nGPyF+uh6SwOL7mWPSxt/Rh8+SHS/4Ao6yJcz5ZPGUnGrJARdTUF4PUDA+GJ0D zZd2HJeFEhQ3vVec83ECvdwF7ipCbMo= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=mDDhRsyA; spf=pass (imf06.hostedemail.com: domain of apopple@nvidia.com designates 40.107.223.72 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662078990; a=rsa-sha256; cv=pass; b=AIYdBvkc6HIUYr1APgUY0Y4FQZRrJ4pL5Cidmpf3BCA2d0Y9Th5VXRlenYnQh6MnLcGhU9 TWq/88AsN1Y0+Qz67F4tuSTj/ZE3lyxFvZdd2orBiBNT0DqXM8dZW86VDPpbjuZEnwpxFi jRVd293w7ayFCBFUkO1BZbS3lO5mdNY= Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=mDDhRsyA; spf=pass (imf06.hostedemail.com: domain of apopple@nvidia.com designates 40.107.223.72 as permitted sender) smtp.mailfrom=apopple@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam11 X-Stat-Signature: 477ko7mpzr5fr4mhcyn5jn6ah4ayxq1b X-Rspamd-Queue-Id: 4DCD6180042 X-Rspam-User: X-HE-Tag: 1662078990-907977 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: Currently we only call flush_cache_page() for the anon_exclusive case, however in both cases we clear the pte so should flush the cache. Signed-off-by: Alistair Popple Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while collecting pages") Cc: stable@vger.kernel.org Reviewed-by: David Hildenbrand Acked-by: Peter Xu --- New for v4 --- mm/migrate_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 6a5ef9f..4cc849c 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -193,9 +193,9 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, bool anon_exclusive; pte_t swp_pte; + flush_cache_page(vma, addr, pte_pfn(*ptep)); anon_exclusive = PageAnon(page) && PageAnonExclusive(page); if (anon_exclusive) { - flush_cache_page(vma, addr, pte_pfn(*ptep)); ptep_clear_flush(vma, addr, ptep); if (page_try_share_anon_rmap(page)) {