Re: [RFC PATCH 0/2] mm/huge_memory: find partially mapped shared folios with NO_PAGE_MAPCOUNT

From: Jose A. Perez de Azpillaga

Date: Sat Nov 14 2026 - 07:46:24 EST


On 11/13/26 9:16 PM, David Hildenbrand (Arm) wrote:
>>> (b) What is the overhead from having way too many folios in the deferred split list.
>>>
>>
>> I don't know yet. I only measured the walk in a TCG guest, nothing on
>> how long the list gets
>
> That would be really interesting. I assume there are some cases where a simple
> fork+exec would already add pages to the deferred split list even thought they
> are briefly after fully mapped by the parent.
>

I tested and, yes, it does. bash doing 200 fork+exec with 64K always
queued 2 folios in total.

[snip]

>>> Maybe one could track it a bit broader? "any page in this set of 16 pages is
>>> present". Reclaiming a single 4k page from a 2M folios is barely worth it.
>>>
>>
>> yes, that works. maybe with the group size scaled to the folio, so the
>> map is one long on the stack and 64K folio still gets one bit per page?
>>
>
> As an alternative, could we also just look for the next page incrementally?
>
> Like, start with offset 0. When we see that, move to offset 1, when we see that,
> move to offset 2 ... and once we saw all pages that way, stop the walk.
>
> I'd assume that, as long as VMAs don't get remapped, that should likely work in
> most cases, right?
>

I tried it. if the parent keeps the second half and the child the first,
a fully mapped folio looks partially mapped. maybe the one long map is
better here?

>> however, maybe if I don't have real evidence, better drop it?
>
> I'd be very interested in an efficient way to test if a folio is partially
> mapped, and where the holes are.
>
> Knowing about the holes could guide a targeted buddy-like folio split.
>
> There was also the idea of letting folio_referenced() for that purpose, when we
> area already doing an rmap walk.
>

okay, I could try that. would you rather have it without the shrinker
walk? with no swap, reclaim wouldn't check those folios.

--
cheers,
jose a. p-a