From patchwork Tue Feb 7 03:51:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chih-En Lin X-Patchwork-Id: 13130973 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B9ECC636CD for ; Tue, 7 Feb 2023 03:55:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230238AbjBGDzr (ORCPT ); Mon, 6 Feb 2023 22:55:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230092AbjBGDzX (ORCPT ); Mon, 6 Feb 2023 22:55:23 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BDD632E47; Mon, 6 Feb 2023 19:54:54 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id z1so14356465plg.6; Mon, 06 Feb 2023 19:54:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B0O7Up3wzI+qFoE2erzvpvdWol4kWXujLVpSiPg8jt0=; b=ImenKRKpVIE1w2d+yNyhMy/Bmoy2fYt1Y3bh919Fjcuemc/XCNtsmCp6Ll9Fjga3qj MBQ891tsWYncJYGiA9yY+OJ7jFg0MgK00ncTozVcs2/dyXQHdd7seoN6utATFCOAJK1T IiYZU7TCWwqybJQlhE9DooQMCwYh6apQ+x6vbO4EgOACpRO57yoAgcWf6z2VtdBw9St2 QebOO3GI3l0z/X8pJUTf0yvmUEKZJvQhTHv4gfIxbNLOjkIfYX5JJFiGN88ORHgE2etN 18rbyA/7Udt4wGqu16BfkrtXkHAV2APrs2IzJYpcNK9y7FxS/WAwzyJ16edRaBK0feb3 gOPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B0O7Up3wzI+qFoE2erzvpvdWol4kWXujLVpSiPg8jt0=; b=4XNJQV1dJh/+Q1GXablXm/+DYbRlJWTmj/iHXkiPHlVZVHYibWXy57SARRTRxWikY3 giWw/Xfm24UO9yx2Yjxt6CSVLdT0gNMHaghx6+5NmJMiawqtXgtN9ame8wcR+7bI85i9 8VuS8UthOgFEtyFLWJHlLUxsoaZ3+T6zah6TXo7/KJeqciqEkrRwefcMzsEo22A9YNE+ Bb5G1YDSduIczI7dvi0A5jX6B9ACQvcNRFyzXhXmoFTOT47gKMeZo9zHZRlNhKif4J+r qHYRhAEaVoBGdgCyicj8vb3aPi138pgkCfpkeqoFK41pqapU6AqGDFtNEiy9wHottVSz oCQg== X-Gm-Message-State: AO0yUKW5DPvwUuHPiQI4vzl5EoZgx7swHDF0WGPpN8V5aKtWJbXzQLCl ZL5ELiQoWsO9fJW0VigaAoA= X-Google-Smtp-Source: AK7set+R6CsRkpduFz4IpgNhrZUmOyLBgEIAcun1eMlrmSOR5DRWSRb+PFgTaXgU2+DZBiANGWjHgw== X-Received: by 2002:a17:902:f693:b0:199:1996:71ed with SMTP id l19-20020a170902f69300b00199199671edmr1724364plg.24.1675742088707; Mon, 06 Feb 2023 19:54:48 -0800 (PST) Received: from strix-laptop.hitronhub.home ([123.110.9.95]) by smtp.googlemail.com with ESMTPSA id q4-20020a170902b10400b0019682e27995sm7647655plr.223.2023.02.06.19.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 19:54:47 -0800 (PST) From: Chih-En Lin To: Andrew Morton , Qi Zheng , David Hildenbrand , "Matthew Wilcox (Oracle)" , Christophe Leroy , John Hubbard , Nadav Amit , Barry Song Cc: Steven Rostedt , Masami Hiramatsu , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Yang Shi , Peter Xu , Vlastimil Babka , "Zach O'Keefe" , Yun Zhou , Hugh Dickins , Suren Baghdasaryan , Pasha Tatashin , Yu Zhao , Juergen Gross , Tong Tiangen , Liu Shixin , Anshuman Khandual , Li kunyu , Minchan Kim , Miaohe Lin , Gautam Menghani , Catalin Marinas , Mark Brown , Will Deacon , Vincenzo Frascino , Thomas Gleixner , "Eric W. Biederman" , Andy Lutomirski , Sebastian Andrzej Siewior , "Liam R. Howlett" , Fenghua Yu , Andrei Vagin , Barret Rhoden , Michal Hocko , "Jason A. Donenfeld" , Alexey Gladkov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Dinglan Peng , Pedro Fonseca , Jim Huang , Huichun Feng , Chih-En Lin Subject: [PATCH v4 11/14] mm/migrate_device: Support COW PTE Date: Tue, 7 Feb 2023 11:51:36 +0800 Message-Id: <20230207035139.272707-12-shiyn.lin@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207035139.272707-1-shiyn.lin@gmail.com> References: <20230207035139.272707-1-shiyn.lin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org Break COW PTE before collecting the pages in COW-ed PTE. Signed-off-by: Chih-En Lin --- mm/migrate_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 721b2365dbca..2930e591e8fc 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -106,6 +106,8 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, } } + if (break_cow_pte_range(vma, start, end)) + return migrate_vma_collect_skip(start, end, walk); if (unlikely(pmd_bad(*pmdp))) return migrate_vma_collect_skip(start, end, walk);