Re: Subject: [BUG/RFC] write-open file THP cache purge can discard dirty page cache

From: Zi Yan

Date: Tue Jun 30 2026 - 18:49:37 EST


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>

--
Best Regards,
Yan, Zi