Re: [PATCH v2] mm: zswap: multiple zpools support

From: Yosry Ahmed
Date: Wed May 31 2023 - 18:25:00 EST


On Wed, May 31, 2023 at 3:21 PM Yu Zhao <yuzhao@xxxxxxxxxx> wrote:
>
> On Wed, May 31, 2023 at 4:13 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> >
> > Support using multiple zpools of the same type in zswap, for concurrency
> > purposes. Add CONFIG_ZSWAP_NR_ZPOOLS_ORDER to control the number of
> > zpools. The order is specific by the config rather than the absolute
> > number to guarantee a power of 2. This is useful so that we can use
> > deterministically link each entry to a zpool by hashing the zswap_entry
> > pointer.
> >
> > On a setup with zswap and zsmalloc, comparing a single zpool (current
> > default) to 32 zpools (by setting CONFIG_ZSWAP_NR_ZPOOLS_ORDER=32) shows
> > improvements in the zsmalloc lock contention, especially on the swap out
> > path.
> >
> > The following shows the perf analysis of the swapout path when 10
> > workloads are simulatenously reclaiming and refaulting tmpfs pages.
>
> simultaneously
>
> > There are some improvements on the swap in path as well, but much less
> > significant.
>
> ...
>
> > ---
> > mm/Kconfig | 12 +++++++
> > mm/zswap.c | 91 ++++++++++++++++++++++++++++++++++++------------------
> > 2 files changed, 73 insertions(+), 30 deletions(-)
> >
> > diff --git a/mm/Kconfig b/mm/Kconfig
> > index 92c30879bf67..de1da56d2c07 100644
> > --- a/mm/Kconfig
> > +++ b/mm/Kconfig
> > @@ -59,6 +59,18 @@ config ZSWAP_EXCLUSIVE_LOADS
> > The cost is that if the page was never dirtied and needs to be
> > swapped out again, it will be re-compressed.
> >
> > +config ZSWAP_NR_ZPOOLS_ORDER
> > + int "Number of zpools in zswap, as power of 2"
> > + default 0
> > + depends on ZSWAP
> > + help
> > + This options determines the number of zpools to use for zswap, it
>
> option

Thanks for taking a look. Will correct both in v3 (if any). Otherwise,
I hope Andrew will fix them in-place :)