Re: [PATCH v1 0/8] Batched zswap_store() with compression batching
From: Kanchana P. Sridhar
Date: Sat Oct 17 2026 - 01:10:40 EST
On Fri, Oct 16, 2026 at 10:07 PM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Oct 16, 2026 at 10:02:13PM -0700, Kanchana P. Sridhar wrote:
> >
> > > What if you just do the conditional and short-circuit in
> > > crypto_acomp_compress?
> >
> > Yes, this is the first option I tried (20,946 KB/s).
> >
> > [1]:
> >
> > int crypto_acomp_compress(struct acomp_req *req)
> > {
> > struct crypto_acomp *tfm = crypto_acomp_reqtfm(req);
> >
> > if (unlikely(acomp_req_on_stack(req) && acomp_is_async(tfm)))
> > return -EAGAIN;
> >
> > if (likely(req->unit_size && acomp_request_issg(req))) {
> > if (likely(!crypto_acomp_req_seg(tfm))) {
> > int err = tfm->compress(req);
> >
> > req->dst->length = unlikely(err) ? err : req->dlen;
> > return err;
> > }
> >
> > return tfm->compress(req);
> > }
> >
> > if (crypto_acomp_req_virt(tfm) || acomp_request_issg(req))
> > return tfm->compress(req);
> >
> > return acomp_do_req_chain(req, true);
> > }
>
> That isn't quite right though. We need to ensure that it really
> is a singleton before taking the short-cut. So you need at
> least one conditional:
>
> if (likely(req->unit_size == req->slen))
> take short-cut
>
Got it. I will give this a try and let you know. Thanks!
> Cheers,
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt