Re: [PATCH] mm: synchronize with PTE table reclaim for all folio sizes
From: Baolin Wang
Date: Thu Nov 05 2026 - 06:29:20 EST
On 11/5/26 6:06 PM, David Hildenbrand (Arm) wrote:
On 11/5/26 10:00, Baolin Wang wrote:
CC Barry, who added the TTU_SYNC in shrink_folio_list().
On 11/5/26 1:48 PM, Lance Yang wrote:
On 2026/11/5 12:54, Lance Yang wrote:
Good catch!
Right. Whether the folio can be PMD-mapped doesn't tell us whether its
PTE table can be reclaimed, so those extra checks can skip synchronization
that the caller explicitly asked for ;)
Ouch ... one thing I missed ... what about order-0 reclaim?
shrink_folio_list() only sets TTU_SYNC for large folio, so can't we still
hit the same race there?
Thanks Lance. But this matches the purpose of the TTU_SYNC flag, which is used
to avoid racy checks with PVMW_SYNC. If no TTU_SYNC flag is set, it means the
caller can tolerate some racy checks.
For this case, I think we should set TTU_SYNC unconditionally in
shrink_folio_list(). Barry, what do you think?
That makes sense. I hope this doesn't throw a big wrench into our reclaim
performance numbers.
Can someone benchmark this?
Sure. I'll measure it if no one objects to this change.
But maybe we should really follow-up with the folio-size based optimization in
sync_with_folio_pmd_zap(), where we only need a memory barrier (and sufficient
documentation why something that cannot be PMD-mapped can get away cheaper).
OK. I'll do this later.