From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Kiryl Shutsemau <kas@kernel.org>,
Usama Arif <usama.arif@linux.dev>, Barry Song <baohua@kernel.org>,
Lance Yang <lance.yang@linux.dev>,
Lorenzo Stoakes <ljs@kernel.org>, Rik van Riel <riel@surriel.com>,
"Liam R . Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
Jann Horn <jannh@google.com>, Zi Yan <ziy@nvidia.com>,
SJ Park <sj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, Sashiko <sashiko-bot@kernel.org>,
azpijr@gmail.com
Subject: Re: [PATCH v1] mm/rmap: fix migration entries being treated as partial unmaps
Date: Fri, 13 Nov 2026 20:23:36 +0100 [thread overview]
Message-ID: <a127857b-d1f6-409d-8c14-3622ea553ae7@kernel.org> (raw)
In-Reply-To: <CAJnrk1aMwrEHdv9v=1cC54QpxzRGpRMbiu07KGfyEhzQNP4XFg@mail.gmail.com>
On 11/13/26 00:28, Joanne Koong wrote:
> On Tue, Nov 10, 2026 at 3:49 AM David Hildenbrand (Arm)
> <david@kernel.org> wrote:
>>
>> Batching resolves the problem in the common case. For the remaining parts, we
>> should likely just check in the deferred split handler whether actually
>> partially mapped to then clear the flag if not.
>
> As I understand it, there's no simple way to check if a folio is
> partially mapped or not under CONFIG_NO_PAGE_MAPCOUNT without doing a
> rmap walk.
Yes. With CONFIG_PAGE_MAPCOUNT you can (still) read the information from the
folio, but the grand plan is to phase that out and remove it.
I just keep getting distracted :)
> Would it make sense to do something simpler here instead
> where we just check the folio's partially mapped flag and cache that
> before we replace the PTEs with migration entries, and then for those
> edge cases that the batching solution doesn't cover, just restore that
> flag back to its original state?
As a last resort if we cannot get something else working (and we really care).
It is rather hacky.
>
> I think this would add coverage for the migration and reclaim paths,
> instead of just the deferred split shrinker, but would miss the race
> where someone tries to do a partial unmap while the folio has the
> migration PTEs, but I think this is already a race that exists in the
> batching case. imo it seems acceptable though given that the race is
> pretty rare and doesn't have any adverse effects except delaying
> freeing the unmapped pages until the whole folio gets unmapped.
>
> Do you think something like this makes sense, or would you prefer
> having the check in the deferred split handler?
The question is, do we really care once we have the PTE batching in place?
We would still split for if we cannot batch (multiple VMAs, PTE differences that
we have to respect). Do we have any idea how much that matters in practice?
(I raised once that, just because a folio is fully mapped doesn't really telly
you anything. It could be mapped into various processes partially, or scattered
in a single process.)
--
Cheers,
David
next prev parent reply other threads:[~2026-11-13 19:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 22:09 [PATCH v1] mm/rmap: fix migration entries being treated as partial unmaps Joanne Koong
2026-11-10 11:48 ` David Hildenbrand (Arm)
2026-11-10 20:21 ` Joanne Koong
2026-11-10 20:55 ` David Hildenbrand (Arm)
2026-11-10 21:05 ` Zi Yan
2026-11-10 23:26 ` Joanne Koong
2026-11-12 23:28 ` Joanne Koong
2026-11-13 19:23 ` David Hildenbrand (Arm) [this message]
2026-11-13 23:51 ` Joanne Koong
2026-11-22 16:11 ` David Hildenbrand (Arm)
2026-11-10 22:13 ` sashiko-bot
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=a127857b-d1f6-409d-8c14-3622ea553ae7@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=azpijr@gmail.com \
--cc=baohua@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=jannh@google.com \
--cc=joannelkoong@gmail.com \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=riel@surriel.com \
--cc=sashiko-bot@kernel.org \
--cc=sj@kernel.org \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=ziy@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