From patchwork Fri Apr 14 14:23:37 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: 13211639 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 E0C98C77B76 for ; Fri, 14 Apr 2023 14:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbjDNO13 (ORCPT ); Fri, 14 Apr 2023 10:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbjDNO05 (ORCPT ); Fri, 14 Apr 2023 10:26:57 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DAABC67C; Fri, 14 Apr 2023 07:26:22 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id n17so2477808pln.8; Fri, 14 Apr 2023 07:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681482381; x=1684074381; 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=w+iY0A30eFtwWyAFuM9+7ULnwLRWOt6NuM4HbKIdcyM=; b=S2PKrNk1rZmPzQjBe3Gp+FFrEA22A/oUwM6sgobCibmvZRzzgfVW7JPEF+Hf3GnoxJ fHQcvhd9v59UQ1RIMxTKJOv6V2IEI0h0UOs0dMB4wnSFcNEEpf95lM8ucoB6BxZjZFxI udsEfh/4nvAcVf9KQ+QZOFe2VYrZduHzu/gfKqOe7ncI8sWohb1RPGhFtgjg4G7iFdLn Vr/JMp0xB6omRyLoRvwI5VOL/iAqvrXB2RKnW7egxBBMPA79pSBcBl5zDOVT8i7bT3e9 b9aVWyD9IEmV6XDaA7HGppl3Zooko4m+CP0CgCsLcjbGZU0/OMex6COYA0MDeCh15YyY 42VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681482381; x=1684074381; 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=w+iY0A30eFtwWyAFuM9+7ULnwLRWOt6NuM4HbKIdcyM=; b=FQe6nB+HKByGSO/iGi2q5snFR3MRx7Eb01wLbG0pWnF9Bxo9tESkQb6K1KpHkaGa3J nNWeoeIPlZnuloqFojUGlNz5pZO8qXSQz7cIkPZQ34kAPZKz8khGOLNasY+RJeNlwGGh 58tDk2LtLNY4E5PRX1O3/mGgfiGIlTuKf3Nhlp9ZbQ5M9nL9gmdWa6j18A3HISQ3XVpT ZmeGntc6uhg+gm1UbvwJTQkVzed89NYbsH+2U9RZ5HDA6v+n7xOnONnkjYCdsBKEIiDS LUOV6760Mr87wLzRogkeLWGA9e1s7cROQAHVbcq3uDcngcNmbT9Buc/Ued0P2BizGdVg 3UcQ== X-Gm-Message-State: AAQBX9defm2cCH4UNVOqxE2KTWm3dvfNqul5I5JkaSfBnSGxXVNWkRMU lwkqJ9HwsePWorVdvPAzCSc= X-Google-Smtp-Source: AKy350aafhYfAjSh+STiWo4YJpjj7PBy7VIF4XlJ5Jf/VkGdL3OLdg6xCGiKRr6Dx+sTOHgJ0Jz+NQ== X-Received: by 2002:a17:90a:a392:b0:246:9517:30b6 with SMTP id x18-20020a17090aa39200b00246951730b6mr11193557pjp.4.1681482381349; Fri, 14 Apr 2023 07:26:21 -0700 (PDT) Received: from strix-laptop.. (2001-b011-20e0-1499-8303-7502-d3d7-e13b.dynamic-ip6.hinet.net. [2001:b011:20e0:1499:8303:7502:d3d7:e13b]) by smtp.googlemail.com with ESMTPSA id h7-20020a17090ac38700b0022335f1dae2sm2952386pjt.22.2023.04.14.07.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 07:26:20 -0700 (PDT) From: Chih-En Lin To: Andrew Morton , Qi Zheng , David Hildenbrand , "Matthew Wilcox (Oracle)" , Christophe Leroy , John Hubbard , Nadav Amit , Barry Song , Pasha Tatashin Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Steven Rostedt , Masami Hiramatsu , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Yu Zhao , Steven Barrett , Juergen Gross , Peter Xu , Kefeng Wang , Tong Tiangen , Christoph Hellwig , "Liam R. Howlett" , Yang Shi , Vlastimil Babka , Alex Sierra , Vincent Whitchurch , Anshuman Khandual , Li kunyu , Liu Shixin , Hugh Dickins , Minchan Kim , Joey Gouly , Chih-En Lin , Michal Hocko , Suren Baghdasaryan , "Zach O'Keefe" , Gautam Menghani , Catalin Marinas , Mark Brown , "Eric W. Biederman" , Andrei Vagin , Shakeel Butt , Daniel Bristot de Oliveira , "Jason A. Donenfeld" , Greg Kroah-Hartman , Alexey Gladkov , x86@kernel.org, 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 Subject: [PATCH v5 13/17] mm/migrate_device: Support COW PTE Date: Fri, 14 Apr 2023 22:23:37 +0800 Message-Id: <20230414142341.354556-14-shiyn.lin@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230414142341.354556-1-shiyn.lin@gmail.com> References: <20230414142341.354556-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 d30c9de60b0d..340a8c39ee3b 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);