From mboxrd@z Thu Jan 1 00:00:00 1970 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 D7C00C00140 for ; Mon, 15 Aug 2022 20:29:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48CB38D0002; Mon, 15 Aug 2022 16:29:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43BBB8D0001; Mon, 15 Aug 2022 16:29:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DC2D8D0002; Mon, 15 Aug 2022 16:29:25 -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 1C9468D0001 for ; Mon, 15 Aug 2022 16:29:25 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D9558160422 for ; Mon, 15 Aug 2022 20:29:24 +0000 (UTC) X-FDA: 79802967048.09.25EABA2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 7073A1401BB for ; Mon, 15 Aug 2022 20:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660595363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yF2p92c7UW45kbBlW38nCYzaIJh2lntG/FxhvA8qLXQ=; b=ceaJVm0s0w224Y06DVhsohxdBidBLsf0Sp8vFOxPzayKHZIHkWZJFsU4p4C9oeo81NOI2c 992iDHfIGK+FNUbhqkml2SOPK7BD/6h1G6Yh+oyV0JBhZ7nb/uebB9P+NCKevHrJQwIkim QAMGXaHCeHeQn2aDm6QPxt/g0GiU/Y0= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-572-7aYtirgoMnOhmOMLFrZldg-1; Mon, 15 Aug 2022 16:29:22 -0400 X-MC-Unique: 7aYtirgoMnOhmOMLFrZldg-1 Received: by mail-qt1-f199.google.com with SMTP id ci6-20020a05622a260600b0034370b6f5d6so6992272qtb.14 for ; Mon, 15 Aug 2022 13:29:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=yF2p92c7UW45kbBlW38nCYzaIJh2lntG/FxhvA8qLXQ=; b=ccwEwV7p6DDTVeLjLf1bgQcG8T/WaPfewBW6e12S1Y6ztIVbQp5+36OtZkLRmITYof XXM61SI+du5aW1G5L8PdzinWBgZ7vyp38CWQAuSk+Nl7VQG6AtFw5ByZ3/BLfSfrSu5i JVHahfYYCEfwzLMu92qutewt9NKY31Vju4ohQg0KbN+2xebwaysfsshm+/yotPsFDXrq kVlRafa0hCOYE2aQGyAteDJpyc1F+ahc1AQi88nPFNKHU3zs69C1vGMmQFJpIW18CI3G B2yIjtLAtVJRkkTzWegQrgr0d30+9jJmzYLbtE23olUlj2P6Q15fBuJjmqr43lG3NXm1 eGBg== X-Gm-Message-State: ACgBeo1cfys8KXz+LZxTsxHa8UWJ7Nh+QTTELH+bGrAulAmL9J7blmVn dY1cjlZVYQfQbV2KuDmTWHdz7m7X1KrazexG7wlNvDNj3dk2fAWOJ2s0TziDDL1EuRqSpVjtodc wOJRcpFAHbBo= X-Received: by 2002:a05:6214:4012:b0:476:f313:7fb with SMTP id kd18-20020a056214401200b00476f31307fbmr15152149qvb.130.1660595362285; Mon, 15 Aug 2022 13:29:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR7M2YNoyb3WxJwIyqbQOJCTtBR3o9E5qdm+nbEnRX6MOjsfXhK1hCLQcLdCsYq6SkZJarEQSQ== X-Received: by 2002:a05:6214:4012:b0:476:f313:7fb with SMTP id kd18-20020a056214401200b00476f31307fbmr15152125qvb.130.1660595362089; Mon, 15 Aug 2022 13:29:22 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id o8-20020ac87c48000000b00343028a9425sm9464004qtv.16.2022.08.15.13.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 13:29:21 -0700 (PDT) Date: Mon, 15 Aug 2022 16:29:20 -0400 From: Peter Xu To: Alistair Popple Cc: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Sierra Guiza, Alejandro (Alex)" , Felix Kuehling , Jason Gunthorpe , John Hubbard , David Hildenbrand , Ralph Campbell , Matthew Wilcox , Karol Herbst , Lyude Paul , Ben Skeggs , Logan Gunthorpe , linuxram@us.ibm.com, paulus@ozlabs.org Subject: Re: [PATCH 1/2] mm/migrate_device.c: Copy pte dirty bit to page Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660595364; a=rsa-sha256; cv=none; b=YUebjCchyBLzb+WfmRAw0cTimY+BuVsfcDva3PiuszmdVz/B5ynfffrZucDhfRFk/sOtwf 9h3mu5Gv4tWpbhEn93SNGtbv3aLAx/17NiUr2qzENsJ7S+HORo+Xp1YtJm+EIAMtn6w3CZ BlNZmBX4H+kR0XQn3PhfhRfTmsLB+08= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ceaJVm0s; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660595364; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yF2p92c7UW45kbBlW38nCYzaIJh2lntG/FxhvA8qLXQ=; b=s/rJ40rH86Zk7OiGNe/aLVAa8ny6cYR6XRMSI/2U1nPABcf1oc/bLUDjQBtjg5oyGqhzuV delcXh5rv8UEA8g4AtSC4J7YWCho4uPxMQ+T6xFL4X1uLcFKKQqaMef4PsnayYLEcdtjXY tJW62kR0Mc9T/acD4PvV8opd9ZZcGeg= X-Stat-Signature: jq671e7in41mu3yitfgcwuk3hhp54jom X-Rspamd-Queue-Id: 7073A1401BB Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ceaJVm0s; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1660595364-877965 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: Hi, Alistair, On Fri, Aug 12, 2022 at 03:22:30PM +1000, Alistair Popple wrote: > migrate_vma_setup() has a fast path in migrate_vma_collect_pmd() that > installs migration entries directly if it can lock the migrating page. > When removing a dirty pte the dirty bit is supposed to be carried over > to the underlying page to prevent it being lost. > > Currently migrate_vma_*() can only be used for private anonymous > mappings. That means loss of the dirty bit usually doesn't result in > data loss because these pages are typically not file-backed. However > pages may be backed by swap storage which can result in data loss if an > attempt is made to migrate a dirty page that doesn't yet have the > PageDirty flag set. > > In this case migration will fail due to unexpected references but the > dirty pte bit will be lost. If the page is subsequently reclaimed data > won't be written back to swap storage as it is considered uptodate, > resulting in data loss if the page is subsequently accessed. > > Prevent this by copying the dirty bit to the page when removing the pte > to match what try_to_migrate_one() does. > > Signed-off-by: Alistair Popple > Reported-by: Peter Xu This line should be: Reported-by: Huang Ying Please also feel free to add: Acked-by: Peter Xu Thanks, -- Peter Xu