Re: [PATCH v1 05/10] mm/huge_memory: remove READ_ONLY_THP_FOR_FS from file_thp_enabled()
From: Andres Freund
Date: Fri Apr 10 2026 - 11:12:58 EST
Hi,
On 2026-03-26 21:42:50 -0400, Zi Yan wrote:
> Replace it with a check on the max folio order of the file's address space
> mapping, making sure PMD_ORDER is supported.
Question from a user space developer (who learned of this via LWN [1]):
Right now MADV_COlLAPSE on file mappings appears to only only work with
CONFIG_READ_ONLY_THP_FOR_FS.
That's pretty sad, because I see quite consistent gains (~15%) from doing
madvise(MADV_COLLAPSE) on e.g. postgres' .text - but because
CONFIG_READ_ONLY_THP_FOR_FS is not enabled default (or at least not commonly,
I think?) in distro kernels, it never quite seemed worth the fiddliness.
Do I understand correctly that by replacing the check here (and the
predecessor commits), madvise(MADV_COLLAPSE) on file mappings might actually
start working in more situations on typical distro kernels?
Greetings,
Andres
[1] https://lwn.net/SubscriberLink/1066582/b92de1d7595a01e4/