Re: [PATCH v4 0/2] fix MADV_COLLAPSE issue if THP settings are disabled
From: Lorenzo Stoakes
Date: Wed Jun 25 2025 - 06:16:44 EST
On Wed, Jun 25, 2025 at 12:07:12PM +0200, David Hildenbrand wrote:
> > Yes, I don't mean it will prevent madvise_collapse(), just as you said
> > that it could be problematic (it's horrible to try to collapse 512MB).
>
> Well, assume you have a VM at that is 2 GiB and could use 4 THPs. It's
> stupid, but there might be some selected use cases where it's not completely
> stupid.
I guess we limit the stupidity by MADV_COLLAPSE working on a PMD-aligned range
so it'll be a no-op for an attempt to collapse 2 MiB (unless I'm misreading the
code).
But it is a bit weird to think that users might assume they will get some
benefit in collapsing a range and in this case would not.
Anyway 64 KiB page sizes throws up a lot worse issues than this (e.g., page
blocks + water marks) so this is tip of the iceberg for that.
>
> --
> Cheers,
>
> David / dhildenb
>
>