Re: [PATCH 1/2] mm/khugepaged: do synchronous writeback for MADV_COLLAPSE

From: Matthew Wilcox
Date: Mon Nov 10 2025 - 09:17:59 EST


On Mon, Nov 10, 2025 at 01:52:46PM +0000, Lorenzo Stoakes wrote:
> On Mon, Nov 10, 2025 at 01:47:10PM +0000, Matthew Wilcox wrote:
> > On Mon, Nov 10, 2025 at 11:32:53AM +0000, Shivank Garg wrote:
> > > When MADV_COLLAPSE is called on file-backed mappings (e.g., executable
> > > text sections), the pages may still be dirty from recent writes. The
> >
> > That explanation derails my brain entirely. Text isn't writable! How
> > can the pages be dirty and file-backed text?
>
> Because they just compiled it and it's not been written back to disk yet :)

So we can avoid these patches simply by changing userspace to call
fsync()? Cool!