Re: [PATCH v4 0/8] Batched zswap_store() framework with compression batching

From: Yosry Ahmed

Date: Wed Nov 25 2026 - 14:46:59 EST


On Wed, Nov 25, 2026 at 10:06 AM Kanchana P. Sridhar
<kanchanapsridhar2026@xxxxxxxxx> wrote:
>
> On Wed, Nov 25, 2026 at 8:31 AM Yosry Ahmed <yosry@xxxxxxxxxx> wrote:
> >
> > [..]
> > > > write_s would be calculated averaging the time in the ".. bytes / ..
> > > > usecs" lines, and free_s by averaging the time from the ".. usecs to free
> > > > memory" lines.
> > > >
> > > > In this run:
> > > > write_s = 37.31 s
> > > > free_s = 23.39 s
> > > >
> > > > With your patches, I got:
> > > > write_s = 37.03 s
> > > > free_s = 18.86 s
> > >
> > > I am not sure how useful it is to apply user-space gettimeofday()
> > > results that time many higher level C code API, as an indicator of
> > > zswap_store() performance.
> >
> > It is useful to see where the time is being spent, and it is consistent
> > with the perf profiles.
> >
> > [..]
> > > > You can see that the cycles spent on zswap_store() are almost the same,
> > > > and the cycle reduction happens in zswap_invalidate().
> > >
> > > The cycles spent in zswap_store() should be normalized to the # of
> > > zswpout events that these CPU cycles represent, for this to be a
> > > reliable measure of latency improvement. There could be an increase in
> > > reclaimed folios for any number of reasons, all of which are not
> > > necessarily due to performance-improvement/degradation of
> > > zswap_store() itself. IOW, more work for less latency per unit of work
> > > is not always indicative of a performance degradation in this case.
> > >
> > > A realistic scenario would be that with zswap_store() becoming more
> > > efficient, the 30 allocating threads cause more memory.high breaches,
> > > that causes more zswpout..
> > > This would cause more CPU cycles in zswap_store(), but the fact
> > > remains that zswap_store() efficiency has improved due to batching.
> >
> > The zswpout number is almost identical: 45,796,107 vs 45,796,089.
>
> Can you also share these vmstat/zswap stats for this run (baseline and
> with patches):
>
> pswpin
> pswpout
> thp_swpout
> thp_swpout_fallback
> zswpin
> zswpout
> zswpwb
> pgmajfault
> 2048kB-alloc
> 2048kB-zswpout
> 2048kB-swpout
> 2048kB-swpout-fallback
> zswap_pool_total_size
> zswap_pool_limit_hit
> zswap_written_back_pages

These are the ones I have. I only enable 2M mTHP so I think most
2048kB-* stats can be derived:

base p1-8
pswpin 0 0
pswpout 0 0
thp_swpout 0 0
thp_swpout_fallback 0 0
zswpin 265 247
zswpout 45,796,107 45,796,089
zswpwb 0 0
pgmajfault 2,811 4,231
thp_fault_alloc 153,600 153,600

The increase in pgmajfault is unrelated, probably because I dropped
caches before runs and these are file page faults. The number of
swapins is ~the same. zswap_pool_limit_hit, zswap_written_back_pages,
and post-run zswap_pool_total_size are all 0 (consistent with
pswpout=0 and zswpwb=0).