On Sun, Nov 19, 2023 at 9:41 PM Huang, Ying <ying.huang@xxxxxxxxx> wrote: > > Chris Li <chrisl@xxxxxxxxxx> writes: > > > On Sun, Nov 19, 2023 at 7:20 PM Huang, Ying <ying.huang@xxxxxxxxx> wrote: > > Per my understanding, memcg uncharging happens in > > swapcache_free_entries() > swap_entry_free() > mem_cgroup_uncharge_swap() > > The swap entries are uncharged one-by-one, not Yes. That matches my understanding as well. I think I am using the term "batching" very loosely. My bad and thanks for the clarification. I am referring to the fact that in most cases, the free_swap_slot() does not perform uncharge. It is grouped together with other entries to uncharge together inside swapcache_free_entries(). Yes, the uncharge itself is done by a for loop page by page. No batching in the for loop. BTW, Not all uncharges can be batched, because they can come from different memcg. Chris