From: Pingfan Liu <kernelfans@gmail.com>
To: Ralph Campbell <rcampbell@nvidia.com>
Cc: "Michal Hocko" <mhocko@kernel.org>, Linux-MM <linux-mm@kvack.org>,
"Jérôme Glisse" <jglisse@redhat.com>,
"John Hubbard" <jhubbard@nvidia.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
"Aneesh Kumar" <aneesh.kumar@linux.vnet.ibm.com>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm/rmap: fix the handling of device private page in try_to_unmap_one()
Date: Tue, 24 Mar 2020 12:21:51 +0800 [thread overview]
Message-ID: <CAFgQCTuoduHWuCFmhHK7TryX_v7Bz9-oxM2Ae7V+JFd4LPmXBQ@mail.gmail.com> (raw)
In-Reply-To: <fc597be6-259a-1951-8812-817d02670861@nvidia.com>
Thanks for your explanation.
On Tue, Mar 24, 2020 at 8:20 AM Ralph Campbell <rcampbell@nvidia.com> wrote:
>
>
> On 3/23/20 12:34 AM, Michal Hocko wrote:
> > On Sun 22-03-20 21:57:07, Pingfan Liu wrote:
> >> For zone_device, migration can only happen on is_device_private_page(page).
> >> Correct the logic in try_to_unmap_one().
> >
> > Maybe it is just me lacking knowledge in the zone_device ZOO. But
> > this really deserves a much more detailed explanation IMHO. It seems
> > a5430dda8a3a ("mm/migrate: support un-addressable ZONE_DEVICE page in
> > migration") deliberately made the decision to allow unmapping these
> > pages? Is the check just wrong, inncomplete? Why?
> >
> > What is the real user visible problem here?
> >
> >> Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> >> Cc: Jérôme Glisse <jglisse@redhat.com>
> >> Cc: Michal Hocko <mhocko@kernel.org>
> >> Cc: John Hubbard <jhubbard@nvidia.com>
> >> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> >> Cc: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
> >> Cc: Andrew Morton <akpm@linux-foundation.org>
> >> To: linux-mm@kvack.org
> >> ---
> >> mm/rmap.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/mm/rmap.c b/mm/rmap.c
> >> index b838647..ffadf3e 100644
> >> --- a/mm/rmap.c
> >> +++ b/mm/rmap.c
> >> @@ -1380,7 +1380,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
> >>
> >> if (IS_ENABLED(CONFIG_MIGRATION) && (flags & TTU_MIGRATION) &&
> >> is_zone_device_page(page) && !is_device_private_page(page))
> >> - return true;
> >> + return false;
>
> Pages can be mapped in multiple vmas. Returning false here will only break out
> of the loop and skip any other vmas mapping this page which is a minor optimization
> but shouldn't really affect what try_to_unmap_one() does.
Yes, it returns false to terminate further iteration. And I think
fs-dax page would not go through this path.
The unmap of fs-dax should go through: umount fs, and arch_remove_memory().
>
> >> if (flags & TTU_SPLIT_HUGE_PMD) {
> >> split_huge_pmd_address(vma, address,
> >> @@ -1487,7 +1487,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
> >>
> >> if (IS_ENABLED(CONFIG_MIGRATION) &&
> >> (flags & TTU_MIGRATION) &&
> >> - is_zone_device_page(page)) {
> >> + is_device_private_page(page)) {
> >> swp_entry_t entry;
> >> pte_t swp_pte;
>
> Since the page was checked for !device private, this is more clear but shouldn't
> change anything.
Yes. It just makes things clear.
Thanks,
Pingfan
next prev parent reply other threads:[~2020-03-24 4:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-22 13:57 Pingfan Liu
2020-03-23 7:34 ` Michal Hocko
2020-03-23 23:32 ` John Hubbard
2020-03-24 3:50 ` Pingfan Liu
2020-03-24 0:20 ` Ralph Campbell
2020-03-24 4:21 ` Pingfan Liu [this message]
2020-03-24 3:47 ` Pingfan Liu
2020-03-24 9:14 ` Michal Hocko
2020-03-25 10:54 ` Pingfan Liu
2020-04-01 14:10 ` Pingfan Liu
2020-03-24 0:04 ` Balbir Singh
2020-03-24 3:55 ` Pingfan Liu
2020-04-01 14:17 ` [PATCH] mm/rmap: fix the handling of !private device " Pingfan Liu
2020-04-01 15:58 ` Michal Hocko
2020-04-02 7:40 ` Pingfan Liu
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=CAFgQCTuoduHWuCFmhHK7TryX_v7Bz9-oxM2Ae7V+JFd4LPmXBQ@mail.gmail.com \
--to=kernelfans@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=rcampbell@nvidia.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