mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "Kanchana P. Sridhar" <kanchanapsridhar2026@gmail.com>
Cc: Yosry Ahmed <yosry@kernel.org>,
	hannes@cmpxchg.org, nphamcs@gmail.com, chengming.zhou@linux.dev,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	davem@davemloft.net, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, rientjes@google.com,
	willy@infradead.org, senozhatsky@chromium.org
Subject: Re: [PATCH v1 0/8] Batched zswap_store() with compression batching
Date: Sat, 17 Oct 2026 13:07:10 +0800	[thread overview]
Message-ID: <atMCfhB63koot230@gondor.apana.org.au> (raw)
In-Reply-To: <CACpmpoe_RXcJM42sTVwk_Qvt3zjAOZhzYZNsRD4xz_1HxDmadg@mail.gmail.com>

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

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

  reply	other threads:[~2026-10-17  5:07 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 18:28 Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 1/8] crypto: acomp - Define a unit_size in struct acomp_req to enable batching. mm: zswap: Set the unit size for zswap to PAGE_SIZE Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 2/8] crypto: acomp - Add bit to indicate segmentation support Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 3/8] crypto: acomp - Add trivial segmentation wrapper Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 4/8] crypto: acomp - Add API to get a compression algorithm's batch-size Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 5/8] mm: zswap: Store the folio's node id in the zswap_entry Kanchana P. Sridhar
2026-10-14  0:18   ` Yosry Ahmed
2026-10-14  1:17     ` Kanchana P. Sridhar
2026-10-14 15:17       ` Yosry Ahmed
2026-10-15 21:30         ` Kanchana P. Sridhar
2026-10-15 21:39           ` Yosry Ahmed
2026-10-15 22:45             ` Kanchana P. Sridhar
2026-10-15 22:48               ` Yosry Ahmed
2026-10-15 22:55                 ` Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 6/8] mm: zswap: Store large folios in batches Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 7/8] mm: zswap: Optimally place members of struct zswap_pool, struct zswap_entry Kanchana P. Sridhar
2026-10-14 15:42   ` Yosry Ahmed
2026-10-15 21:48     ` Kanchana P. Sridhar
2026-10-15 22:06       ` Yosry Ahmed
2026-10-15 22:53         ` Kanchana P. Sridhar
2026-10-08 18:28 ` [PATCH v1 8/8] mm: zswap: Batched zswap_compress() for storing large folios in batches Kanchana P. Sridhar
2026-10-14 15:45 ` [PATCH v1 0/8] Batched zswap_store() with compression batching Yosry Ahmed
2026-10-15 22:00   ` Kanchana P. Sridhar
2026-10-15 22:04     ` Yosry Ahmed
2026-10-15 22:51       ` Kanchana P. Sridhar
2026-10-15 22:59         ` Yosry Ahmed
2026-10-15 23:40           ` Kanchana P. Sridhar
2026-10-15 23:44             ` Yosry Ahmed
2026-10-16  3:32               ` Kanchana P. Sridhar
2026-10-16  4:38                 ` Herbert Xu
2026-10-16  4:42                   ` Kanchana P. Sridhar
2026-10-17  3:03                   ` Kanchana P. Sridhar
2026-10-17  4:12                     ` Herbert Xu
2026-10-17  5:02                       ` Kanchana P. Sridhar
2026-10-17  5:07                         ` Herbert Xu [this message]
2026-10-17  5:10                           ` Kanchana P. Sridhar
2026-10-16 16:14 ` Yosry Ahmed
2026-10-16 19:04   ` Kanchana P. Sridhar
2026-10-16 21:48     ` Yosry Ahmed
2026-10-17  3:53       ` Kanchana P. Sridhar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=atMCfhB63koot230@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=davem@davemloft.net \
    --cc=hannes@cmpxchg.org \
    --cc=kanchanapsridhar2026@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=rientjes@google.com \
    --cc=senozhatsky@chromium.org \
    --cc=willy@infradead.org \
    --cc=yosry@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®