Re: [PATCH v1 00/10] Remove READ_ONLY_THP_FOR_FS Kconfig

David Hildenbrand (Arm)
2026-03-27T13:46:56Z

On 3/27/26 02:42, Zi Yan wrote:
> Hi all,
>
> This patchset removes READ_ONLY_THP_FOR_FS Kconfig and enables creating
> read-only THPs for FSes with large folio support (the supported orders
> need to include PMD_ORDER) by default.
>
> The changes are:
> 1. collapse_file() from mm/khugepaged.c, instead of checking
> CONFIG_READ_ONLY_THP_FOR_FS, makes sure the mapping_max_folio_order()
> of struct address_space of the file is at least PMD_ORDER.
> 2. file_thp_enabled() also checks mapping_max_folio_order() instead.
> 3. truncate_inode_partial_folio() calls folio_split() directly instead
> of the removed try_folio_split_to_order(), since large folios can
> only show up on a FS with large folio support.
> 4. nr_thps is removed from struct address_space, since it is no longer
> needed to drop all read-only THPs from a FS without large folio
> support when the fd becomes writable. Its related filemap_nr_thps*()
> are removed too.
> 5. folio_check_splittable() no longer checks READ_ONLY_THP_FOR_FS.
> 6. Updated comments in various places.
>
> Changelog
> ===
> From RFC[1]:
> 1. instead of removing READ_ONLY_THP_FOR_FS function entirely, turn it
> on by default for all FSes with large folio support and the supported
> orders includes PMD_ORDER.
>
> Suggestions and comments are welcome.

Hi! :)

The patch set might be better structured by

1) Teaching code paths to not only respect READ_ONLY_THP_FOR_FS but also
filesystems with large folios. At that point, READ_ONLY_THP_FOR_FS would
have no effect.

2) Removing READ_ONLY_THP_FOR_FS along with all the old cruft that is no
longer required

MADV_COLLAPSE will keep working the whole time.

--
Cheers,

David