Re: [PATCH] mm: Optimize TLB flushes during page reclaim

From: Vinay Banakar
Date: Wed Jan 22 2025 - 08:29:27 EST


On Wed, Jan 22, 2025 at 2:59 AM Bharata B Rao <bharata@xxxxxxx> wrote:
> While that may be true for MADV_PAGEOUT path, does the same assumption
> hold good for other paths from which shrink_folio_list() gets called?

shrink_folio_list() is called by three other functions, each with
different batching behavior:
- reclaim_clean_pages_from_list(): Doesn't do PMD batching but only
processes clean pages, so it won't take the path affected by this
patch. This is called from the contiguous memory allocator
(cma_alloc#alloc_contig_range)
- shrink_inactive_list(): Reclaims inactive pages at SWAP_CLUSTER_MAX
(default 32) at a time. With this patch, we will reduce IPIs for TLB
flushes by a factor of 32 in kswapd
- evict_folios(): In the MGLRU case, the number of pages
shrink_folio_list() processes can vary between 64 (MIN_LRU_BATCH) and
4096 (MAX_LRU_BATCH). The reduction in IPIs will vary accordingly

Thanks!
Vinay