Re: [PATCH v0 0/2] mm: swap: Gather swap entries and batch async release

From: Barry Song

Date: Tue Oct 14 2025 - 16:42:49 EST


>
> Hi Barry
>
> Thank you for your question. Here is the issue we are encountering:
>
> Flame graph of time distribution for douyin process exit (~400MB swapped):
> do_notify_resume 3.89%
> get_signal 3.89%
> do_signal_exit 3.88%
> do_exit 3.88%
> mmput 3.22%
> exit_mmap 3.22%
> unmap_vmas 3.08%
> unmap_page_range 3.07%
> free_swap_and_cache_nr 1.31%****
> swap_entry_range_free 1.17%****
> zram_slot_free_notify 1.11%****

If 1.11/1.31, or 85% of free_swap_and_cache_nr, comes from zram_free,
it’s clear that the swap/mm core is not the right place for this optimization.

As it involves too much complexity—for example, synchronization between
swapoff and your new threads.

> zram_free_hw_entry_dc 0.43%
> free_zspage[zsmalloc] 0.09%

Thanks
Barry