From: David Hildenbrand <david@redhat.com>
To: Yosry Ahmed <yosryahmed@google.com>,
"Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Yu Zhao <yuzhao@google.com>,
"Jan Alexander Steffens (heftig)" <heftig@archlinux.org>,
Steven Barrett <steven@liquorix.net>,
Brian Geffon <bgeffon@google.com>,
"T.J. Alumbaugh" <talumbau@google.com>,
Gaosheng Cui <cuigaosheng1@huawei.com>,
Suren Baghdasaryan <surenb@google.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
David Howells <dhowells@redhat.com>,
Hugh Dickins <hughd@google.com>, Greg Thelen <gthelen@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 5/5] Revert "mm/migrate: __unmap_and_move() push good newpage to LRU"
Date: Mon, 19 Jun 2023 09:58:06 +0200 [thread overview]
Message-ID: <de807972-92c5-8c6c-d2c7-9df07d1e8d37@redhat.com> (raw)
In-Reply-To: <9f53b80e-7083-705a-88d3-7f3f33dd9c4b@redhat.com>
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@intel.com> wrote:
>>>
>>> Hi, Yosry,
>>>
>>> Yosry Ahmed <yosryahmed@google.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@google.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@intel.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).
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-06-19 7:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-18 6:58 Yosry Ahmed
2023-06-19 1:57 ` Huang, Ying
2023-06-19 3:59 ` Yosry Ahmed
2023-06-19 4:27 ` Huang, Ying
2023-06-19 4:34 ` Yosry Ahmed
2023-06-19 7:56 ` David Hildenbrand
2023-06-19 7:58 ` David Hildenbrand [this message]
2023-06-20 17:09 ` Yosry Ahmed
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=de807972-92c5-8c6c-d2c7-9df07d1e8d37@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=bgeffon@google.com \
--cc=cuigaosheng1@huawei.com \
--cc=dhowells@redhat.com \
--cc=gthelen@google.com \
--cc=heftig@archlinux.org \
--cc=hughd@google.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=steven@liquorix.net \
--cc=surenb@google.com \
--cc=talumbau@google.com \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
--cc=yosryahmed@google.com \
--cc=yuzhao@google.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