From: Hillf Danton <hdanton@sina.com>
To: Peter Xu <peterx@redhat.com>
Cc: kernel test robot <lkp@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
linux-kernel@vger.kernel.org
Subject: Re: f45ec5ff16 ("userfaultfd: wp: support swap and page migration"): BUG: Bad rss-counter state
Date: Sat, 11 Apr 2020 09:21:25 +0800 [thread overview]
Message-ID: <20200411012126.4544-1-hdanton@sina.com> (raw)
In-Reply-To: <20200410073209.11164-1-hdanton@sina.com>
Hi Peter
On Fri, 10 Apr 2020 11:32:34 -0400 Peter Xu wrote:
>
> I'm not sure this is correct. As I mentioned, the commit wanted to
> apply the uffd-wp bit even for the swap entries so that even the swap
> entries got swapped in, the page will still be write protected. So
> IIUC think we can't remove that.
>
Thank you for explaining that we would flip-flop uffd-wp in f45ec5ff16.
The input to test robot now looks like the diff below after restoring
CONFIG_MIGRATION.
--- b/mm/mprotect.c
+++ c/mm/mprotect.c
@@ -139,9 +139,9 @@ static unsigned long change_pte_range(st
}
ptep_modify_prot_commit(vma, addr, pte, oldpte, ptent);
pages++;
- } else if (is_swap_pte(oldpte)) {
+ } else if (IS_ENABLED(CONFIG_MIGRATION)) {
swp_entry_t entry = pte_to_swp_entry(oldpte);
- pte_t newpte;
+ pte_t newpte = oldpte;
if (is_write_migration_entry(entry)) {
/*
@@ -154,7 +154,9 @@ static unsigned long change_pte_range(st
newpte = pte_swp_mksoft_dirty(newpte);
if (pte_swp_uffd_wp(oldpte))
newpte = pte_swp_mkuffd_wp(newpte);
- } else if (is_write_device_private_entry(entry)) {
+ }
+
+ if (is_write_device_private_entry(entry)) {
/*
* We do not preserve soft-dirtiness. See
* copy_one_pte() for explanation.
@@ -163,8 +165,6 @@ static unsigned long change_pte_range(st
newpte = swp_entry_to_pte(entry);
if (pte_swp_uffd_wp(oldpte))
newpte = pte_swp_mkuffd_wp(newpte);
- } else {
- newpte = oldpte;
}
if (uffd_wp)
next prev parent reply other threads:[~2020-04-11 1:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 0:25 f45ec5ff16 ("userfaultfd: wp: support swap and page migration"): [ 140.777858] BUG: Bad rss-counter state mm:b278fc66 type:MM_ANONPAGES val:1 kernel test robot
2020-04-10 7:32 ` Hillf Danton
2020-04-10 15:32 ` Peter Xu
2020-04-10 15:38 ` Matthew Wilcox
2020-04-10 18:14 ` Peter Xu
2020-04-11 1:21 ` Hillf Danton [this message]
2020-04-12 12:54 ` Hillf Danton
2020-04-12 21:45 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200411012126.4544-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=peterx@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox