Re: [PATCH v2 06/26] mm/fbatch: fbatch_drain_lazyfree(onstack fbatch) before ptl unlock
From: Vlastimil Babka (SUSE)
Date: Wed Sep 09 2026 - 17:20:37 EST
On 9/9/26 11:53, Hugh Dickins wrote:
> Re-enable lazyfree batching for MADV_FREE. But it's not safe now to leave
> potentially stale (then reused) folios in a per-cpu fbatch for lazyfree.
> Instead, madvise_free_pte_range() keep an fbatch on its stack, and drain
> it each time before dropping pagetable lock, while the folios are secure.
>
> Ignore folio_may_be_lru_cached() and lru_cache_disabled(): limitations
> irrelevant to this fbatch drained under spinlock (even if RT); though
> in practice madvise_free_huge_pmd() does have to drain every time.
>
> Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
It seems correct to me, so:
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
Might be that something regresses performance though. Guess we'll see.
Also seems to me that if this patch was preparatory, the batching wouldn't
have to be temporarily disabled. Doesn't matter ultimately though.