On Fri, Mar 27, 2026 at 02:46:43PM +0100, David Hildenbrand (Arm) wrote: > 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.
And also please do some cleaning up of the mess we have in the code base if at all possible :) I feel like we're constantly building on sand with this, and should treat every major change as a chance to do this. Or otherwise we constantly keep leaving this mess around to deal with... > > 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. Obviously everything should keep working throughout any version of this series. > > -- > Cheers, > > David Cheers, Lorenzo

