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

Matthew Wilcox
2026-04-13T22:29:16Z

On Mon, Apr 13, 2026 at 04:51:28PM -0400, Zi Yan wrote:
> 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.

That sounds like more code that was added for RO_THP and should be
deleted? See commit e6be37b2e7bd