Re: [PATCH v5 01/14] mm/khugepaged: remove READ_ONLY_THP_FOR_FS check

Andrew Morton
2026-04-30T15:04:23Z

On Thu, 30 Apr 2026 10:37:52 -0400 Zi Yan <ziy@nvidia.com> wrote:

> + * MADV_COLLAPSE ignores shmem huge config, so do not check shmem
> > + *
> > + * TODO: once shmem always calls mapping_set_large_folios() on its
> > + * mapping, the shmem check can be removed.
> > + */
> > + VM_WARN_ON_ONCE(!is_shmem && !mapping_pmd_folio_support(mapping));
>
> sashiko asked:
> Is it possible for userspace to intentionally trigger this warning via
> madvise(MADV_COLLAPSE) on an unsupported read-only file? Although in
> a later commit, modified file_thp_enabled() will prevent this.
>
> Answer:
> It is possible when CONFIG_READ_ONLY_THP_FOR_FS is enabled, but it is
> unlikely a kernel will be shipped at this exact commit.

Yeah, let's not worry about minor bisection holes.