[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJD7tkbs2UR-waAnUjBH_8GbVbpAyQz-yqHHOcS6PrTm1BzeUg@mail.gmail.com>
Date: Tue, 20 Jun 2023 10:09:20 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: David Hildenbrand <david@...hat.com>
Cc: "Huang, Ying" <ying.huang@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Yu Zhao <yuzhao@...gle.com>,
"Jan Alexander Steffens (heftig)" <heftig@...hlinux.org>,
Steven Barrett <steven@...uorix.net>,
Brian Geffon <bgeffon@...gle.com>,
"T.J. Alumbaugh" <talumbau@...gle.com>,
Gaosheng Cui <cuigaosheng1@...wei.com>,
Suren Baghdasaryan <surenb@...gle.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
David Howells <dhowells@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Greg Thelen <gthelen@...gle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 5/5] Revert "mm/migrate: __unmap_and_move() push good
newpage to LRU"
On Mon, Jun 19, 2023 at 12:58 AM David Hildenbrand <david@...hat.com> wrote:
>
> On 19.06.23 09:56, David Hildenbrand wrote:
> > On 19.06.23 05:59, Yosry Ahmed wrote:
> >> On Sun, Jun 18, 2023 at 7:00 PM Huang, Ying <ying.huang@...el.com> wrote:
> >>>
> >>> Hi, Yosry,
> >>>
> >>> Yosry Ahmed <yosryahmed@...gle.com> writes:
> >>>
> >>>> This reverts commit c3096e6782b733158bf34f6bbb4567808d4e0740.
> >>>>
> >>>> That commit made sure we immediately add the new page to the LRU before
> >>>> remove_migration_ptes() is called in migrate_move_folio() (used to be
> >>>> __unmap_and_move() back then), such that the rmap walk will rebuild the
> >>>> correct mlock_count for the page again. This was needed because the
> >>>> mlock_count was lost when the page is isolated. This is no longer the
> >>>> case since mlock_count no longer overlays page->lru.
> >>>>
> >>>> Revert the commit (the code was foliated afterward the commit, so the
> >>>> revert is updated as such).
> >>>>
> >>>> Signed-off-by: Yosry Ahmed <yosryahmed@...gle.com>
> >>>> ---
> >>>> mm/migrate.c | 24 +++++++++---------------
> >>>> 1 file changed, 9 insertions(+), 15 deletions(-)
> >>>>
> >>>> diff --git a/mm/migrate.c b/mm/migrate.c
> >>>> index 01cac26a3127..68f693731865 100644
> >>>> --- a/mm/migrate.c
> >>>> +++ b/mm/migrate.c
> >>>> @@ -1279,19 +1279,6 @@ static int migrate_folio_move(free_page_t put_new_page, unsigned long private,
> >>>> if (unlikely(!is_lru))
> >>>> goto out_unlock_both;
> >>>
> >>> The patch itself looks good to me! Thanks!
> >>>
> >>> Reviewed-by: "Huang, Ying" <ying.huang@...el.com>
> >>
> >> Thanks for taking a look!
> >>
> >>>
> >>> And, it seems that we can remove the above 2 lines and "out_unlock_both"
> >>> label now. That can make the code simpler a little. Right?
> >>
> >> I am not familiar with this code. If we remove the above condition
> >> then pages that have is_lru == 0 (i.e __PageMovable(src) is true) and
> >> page_was_mapped == 1 will call remove_migration_ptes(). This wouldn't
> >> happen without removing the above 2 lines. If this combination is
> >> impossible (is_lru == 0 && page_was_mapped == 1), then yeah we can
> >> remove the above condition.
> >>
> >> It looks like __SetPageMovable() is only called by zsmalloc, z3fold,
> >> and balloon_page_insert(). The former 2 will never have those pages
> >> mapped into userspace. I am not familiar with balloon_page_insert(),
> >> but my gut feeling is that those are pages used by the driver and are
> >> also not mapped into userspace.
> >
> > On XEN, there is xen_alloc_ballooned_pages(), which ends up mapping
> > balloon-inflated pages into user space (for something like MMIO IIRC).
> > But the XEN balloon does not use the balloon compaction framework, so
> > __SetPageMovable() does not apply.
> >
> > The other balloon_page_insert() users (VMware balloon, CMM,
> > virtio-balloon) shouldn't be doing something like that.
>
> Ah, and I remember they even can't, because in balloon_page_insert() we
> also do a __SetPageOffline(). And such typed pages cannot be mapped into
> user space (because the type overlays the mapcount).
Thanks David, good to know! I will remove the condition as Ying
suggested in the next version then!
>
> --
> Cheers,
>
> David / dhildenb
>
Powered by blists - more mailing lists