Re: [PATCH 7.2 v2 12/12] selftests/mm: remove READ_ONLY_THP_FOR_FS from comments in guard-regions

Zi Yan
2026-04-13T20:51:37Z

On 13 Apr 2026, at 16:47, Matthew Wilcox wrote:

> On Mon, Apr 13, 2026 at 03:20:30PM -0400, Zi Yan wrote:
>> +++ b/tools/testing/selftests/mm/guard-regions.c
>> @@ -2205,7 +2205,7 @@ TEST_F(guard_regions, collapse)
>>
>> /*
>> * We must close and re-open local-file backed as read-only for
>> - * CONFIG_READ_ONLY_THP_FOR_FS to work.
>> + * MADV_COLLAPSE to work.
>
> Is this true? Does MADV_COLLAPSE refuse to work on writable files?
> Should we delete some code here as well as fix the comment? ;-)

file_thp_enabled() used by __thp_vma_allowable_orders() refuses
writable files with inode_is_open_for_write(). That should prevent
MADV_COLLAPSE from working on writable files.

Best Regards,
Yan, Zi