Re: Subject: [BUG/RFC] write-open file THP cache purge can discard dirty page cache
From: Pedro Falcato
Date: Wed Jul 01 2026 - 08:05:23 EST
On Tue, Jun 30, 2026 at 06:48:39PM -0400, Zi Yan wrote:
> On Tue Jun 30, 2026 at 3:55 PM EDT, Pedro Falcato wrote:
> > On Tue, Jun 30, 2026 at 07:49:12PM +0100, Pedro Falcato wrote:
> > snip
> >>
> >> Other idea: perhaps doing filemap_write_and_wait() after the nr_thps
> >> increment in collapse_file() will Just Work and result in a _much_
> >> simpler fix. And it avoids any weird forward-progress issues as no one can
> >> write to folios at that point.
> >>
> >
> > Gregg, if you could test this patch, it would be much appreciated. This patch
> > (hopefully) makes it so no dirty folio will ever coexist with a ro-THP, thus
> > hopefully sidestepping the entire issue in a simple way. Only compile-tested
> > and not reviewed.
>
> I tested the patch on v6.12 kernel with the reproducer from Gregg and
> confirmed that the issue is fixed.
>
> Feel free to add
> Tested-by: Zi Yan <ziy@xxxxxxxxxx>
Awesome, thanks!
--
Pedro