Re: [PATCH] mm: filemap: skip dropbehind folios during fault-around
From: Matthew Wilcox
Date: Sun Aug 30 2026 - 08:40:39 EST
On Sun, Aug 30, 2026 at 07:48:45PM +0800, Wenjie Qi wrote:
> From: Wenjie Qi <qiwenjie@xxxxxxxxxx>
>
> filemap_map_pages() maps uptodate folios speculatively without going
> through the normal filemap lookup that clears dropbehind. As a result,
> a neighboring dropbehind folio can acquire a PTE and the mapped-folio
> completion guard will retain it even if that PTE is never accessed.
>
> Skip still-dropbehind folios in next_uptodate_folio(). If the skipped
> folio covers the fault address, do_read_fault() falls back to
> filemap_fault(), where the normal lookup clears dropbehind and updates
> WB_DONTCACHE_DIRTY accounting before mapping it. Speculative neighbors
> remain unmapped and can be discarded when I/O completes. Normal folios
> continue to use fault-around.
>
> Dropbehind is folio-wide, so a fault into any subpage retains the whole
> large folio through the normal fault path.
I don't think we should do this. Even if a folio is brought in through
fault-around, it still indicates some conflict between dropbehind and
another user, which indicates that the dropbehind hint was wrong.