Re: [PATCH 5/6] mm/zswap: only support zswap_exclusive_loads_enabled

Johannes Weiner
2024-02-02T16:26:37Z

On Fri, Feb 02, 2024 at 08:57:38PM +0800, Chengming Zhou wrote:
> On 2024/2/2 02:12, Johannes Weiner wrote:
> > Caching "swapout work" is helpful when the system is thrashing. Then
> > recently swapped in pages might get swapped out again very soon. It
> > certainly makes sense with conventional swap, because keeping a clean
> > copy on the disk saves IO work and doesn't cost any additional memory.
> >
> > But with zswap, it's different. It saves some compression work on a
> > thrashing page. But the act of keeping compressed memory contributes
> > to a higher rate of thrashing. And that can cause IO in other places
> > like zswap writeback and file memory.
>
> [...] A/B test kernel building in tmpfs directory, memory.max=2GB.
> (zswap writeback enabled and shrinker_enabled, one 50GB swapfile)
>
> From the below results, exclusive mode has fewer scan and refault.
>
> zswap-invalidate-entry zswap-invalidate-entry-exclusive
> real 63.80 63.01
> user 1063.83 1061.32
> sys 290.31 266.15
> zswap-invalidate-entry zswap-invalidate-entry-exclusive
> workingset_refault_anon 2383084.40 1976397.40
> workingset_refault_file 44134.00 45689.40
> workingset_activate_anon 837878.00 728441.20
> workingset_activate_file 4710.00 4085.20
> workingset_restore_anon 732622.60 639428.40
> workingset_restore_file 1007.00 926.80
> workingset_nodereclaim 0.00 0.00
> pgscan 14343003.40 12409570.20
> pgscan_kswapd 0.00 0.00
> pgscan_direct 14343003.40 12409570.20
> pgscan_khugepaged 0.00 0.00

That's perfect. Thanks!

Would you mind adding all of the above into the changelog?

With that,

Acked-by: Johannes Weiner <hannes@cmpxchg.org>