RE: [PATCH v12 23/23] mm: zswap: Batched zswap_compress() with compress batching of large folios.

From: Sridhar, Kanchana P

Date: Fri Oct 31 2025 - 18:18:21 EST



> -----Original Message-----
> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, October 21, 2025 10:18 PM
> To: Sridhar, Kanchana P <kanchana.p.sridhar@xxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx;
> hannes@xxxxxxxxxxx; yosry.ahmed@xxxxxxxxx; nphamcs@xxxxxxxxx;
> chengming.zhou@xxxxxxxxx; usamaarif642@xxxxxxxxx;
> ryan.roberts@xxxxxxx; 21cnbao@xxxxxxxxx;
> ying.huang@xxxxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx;
> senozhatsky@xxxxxxxxxxxx; sj@xxxxxxxxxx; kasong@xxxxxxxxxxx; linux-
> crypto@xxxxxxxxxxxxxxx; davem@xxxxxxxxxxxxx; clabbe@xxxxxxxxxxxx;
> ardb@xxxxxxxxxx; ebiggers@xxxxxxxxxx; surenb@xxxxxxxxxx; Accardi,
> Kristen C <kristen.c.accardi@xxxxxxxxx>; Gomes, Vinicius
> <vinicius.gomes@xxxxxxxxx>; Feghali, Wajdi K <wajdi.k.feghali@xxxxxxxxx>;
> Gopal, Vinodh <vinodh.gopal@xxxxxxxxx>
> Subject: Re: [PATCH v12 23/23] mm: zswap: Batched zswap_compress() with
> compress batching of large folios.
>
> On Thu, Sep 25, 2025 at 08:35:02PM -0700, Kanchana P Sridhar wrote:
> >
> > Another initialization level optimization that happens in
> > zswap_cpu_comp_prepare() is, only for batching compressors, we allocate
> > extra memory for "batch-size" int pointers in the
> > @acomp_ctx->req->__ctx[] that are statically set to track the output SG
> > lists' lengths. This optimization was necessary to avoid the latency
>
> There is no need for this allocation. Just store the output lengths
> in each destination scatterlist entry.

Thanks Herbert, for this suggestion. I have included this in the v13 code
that I am currently validating and expect to post an updated patch-set
within a couple of days.

>
> Before the call to acomp, the destination SG list should contain as
> many elements as the number of units. On return, the dst lengths
> should be stored in each destination SG entry.

Yes, confirming that this is the case.

Best regards,
Kanchana

>
> Cheers,
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt