Re: [RFC v2 0/3] Decoupling large folios dependency on THP

From: Zi Yan

Date: Tue Mar 03 2026 - 11:50:16 EST


On 3 Mar 2026, at 9:17, Pankaj Raghav wrote:

> On 2/27/2026 6:31 AM, Matthew Wilcox wrote:
>> On Sat, Dec 06, 2025 at 04:08:55AM +0100, Pankaj Raghav wrote:
>>> There are multiple solutions to solve this problem and this is one of
>>> them with minimal changes. I plan on discussing possible other solutions
>>> at the talk.
>>
>> Here's an argument. The one remaining caller of add_to_page_cache_lru()
>> is ramfs_nommu_expand_for_mapping(). Attached is a patch which
>> eliminates it ... but it doesn't compile because folio_split() is
>> undefined on nommu.
>>
>> So either we need to reimplement all the good stuff that folio_split()
>> does for us, or we need to make folio_split() available on nommu.
>>
>
> I had a question, one conclusion I came to was: folio splitting depends on THP, so we either need to implement the split logic without THP dependency or just make sure we don't split a large folio at all when we use large folio (what I did in this RFC but not a great long term solution).

Why? What folio split does:
1. unmap pagecache folios or freeze anon folios with migration entries
2. split the folio to small ones and handle other related meta data like
page owner, pgalloc tags, swap, pagecache index info, or others
3. remove migration entries for anon folios, do nothing for pagecache folio.

Unless the large folio is PMD mapped, splitting other large folios should
work without THP.

>
> So even if we implement folio_split without any dependency on THP, do we need to re-implement or make folio_split available for nommu? I am also wondering how nommu code is related to removing large folios dependency on THP.
>
> --
> Pankaj


Best Regards,
Yan, Zi