Re: [PATCH v3 5/5] mm/vmscan: flush TLB for every 31 folios evictions

From: Barry Song

Date: Fri Apr 10 2026 - 20:37:21 EST


On Fri, Apr 10, 2026 at 8:48 PM Zhang Peng <zippermonkey@xxxxxxxxxx> wrote:
>
> From: Zhang Peng <bruzzhang@xxxxxxxxxxx>
>
> Currently we flush TLB for every dirty folio, which is a bottleneck for
> systems with many cores as this causes heavy IPI usage.
>
> So instead, batch the folios, and flush once for every 31 folios (one
> folio_batch). These folios will be held in a folio_batch releasing their
> lock, then when folio_batch is full, do following steps:
>
> - For each folio: lock - check still evictable (writeback, mapped,
> dma_pinned)
> - If no longer evictable, put back to LRU
> - Flush TLB once for the batch
> - Pageout the folios
>
> Suggested-by: Kairui Song <kasong@xxxxxxxxxxx>
> Signed-off-by: Zhang Peng <bruzzhang@xxxxxxxxxxx>

This sounds like a pretty good idea, but let’s revisit it
after you clean up 1–4.

Best Regards
Barry