On Thu, Apr 06, 2023 at 12:18:53AM +0800, Qi Zheng wrote: > The ->percpu_pvec_drained was originally introduced by > commit d9ed0d08b6c6 ("mm: only drain per-cpu pagevecs once per > pagevec usage") to drain per-cpu pagevecs only once per pagevec > usage. But after converting the swap code to be more folio-based, > the commit c2bc16817aa0 ("mm/swap: add folio_batch_move_lru()") > breaks this logic, which would cause ->percpu_pvec_drained to be > reset to false, that means per-cpu pagevecs will be drained > multiple times per pagevec usage. My mistake. I didn't reaise that we'd need a folio_batch_reinit(), and indeed we didn't have one until 811561288397 (January 2023). I thought this usage of percpu_pvec_drained was going to be fine with being set to false each time. Thanks for showing I was wrong. > Fixes: c2bc16817aa0 ("mm/swap: add folio_batch_move_lru()") > Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx> Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>