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

From: Pedro Falcato

Date: Tue Jun 30 2026 - 15:55:41 EST


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.

--
Pedro