Re: [PATCH 2/2] mm, vmscan: flush TLB for every 31 folios evictions

Zhang Peng
2026-03-09T14:56:48Z

Hi Usama,

Thanks for the review!

You are right that the comment is wrong, page_ref_freeze does not exist in
pageout_batch(). I will fix the comment in v2.

Regarding the data corruption concern: try_to_unmap_flush_dirty() is called
before pageout_one(), so all stale writable TLB entries are invalidated
before
IO starts. Any writes through stale TLB entries during the unlocked
window will
have completed and landed in physical memory before the flush, and will be
correctly captured by the subsequent IO.

pageout_batch() relocks each folio and rechecks its state (writeback, lru,
mapped, dma_pinned) before proceeding. If any of these conditions have
changed
during the unlocked window, the folio is not written out and is put back
to the
LRU list for a future reclaim attempt. So there should be no data corruption
issue.

I will also add folio_maybe_dma_pinned() check in v2 as suggested by
Kairui Song.