From: sashiko-bot@kernel.org
To: "Kanchana P. Sridhar" <kanchanapsridhar2026@gmail.com>,
hannes@cmpxchg.org, yosry@kernel.org, nphamcs@gmail.com,
chengming.zhou@linux.dev, akpm@linux-foundation.org,
linux-mm@kvack.org, herbert@gondor.apana.org.au,
davem@davemloft.net, linux-crypto@vger.kernel.org
Cc: rientjes@google.com, willy@infradead.org, senozhatsky@chromium.org
Subject: Re: [PATCH v4 4/8] crypto: acomp - Add API to get a compression algorithm's batch-size.
Date: Sat, 21 Nov 2026 04:20:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-226634@kernel.org> (raw)
In-Reply-To: <20261120041906.5785-5-kanchanapsridhar2026@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] crypto: acomp: crypto_acomp_batch_size() checks async instead
of req_seg
--
commit 4f8164105102abaa98a8641d32dd35c9cb223ee0
Author: Kanchana P. Sridhar <kanchanapsridhar2026@gmail.com>
crypto: acomp - Add API to get a compression algorithm's batch-size.
This commit adds a batch_size field to struct acomp_alg and introduces
crypto_acomp_batch_size() so callers can query the maximum batch size supported
by an acomp algorithm.
> diff --git a/crypto/acompress.c b/crypto/acompress.c
> index ac4dc52668b89..df9e42f519c35 100644
> --- a/crypto/acompress.c
> +++ b/crypto/acompress.c
> @@ -327,6 +327,20 @@ int crypto_acomp_decompress(struct acomp_req *req)
> }
> EXPORT_SYMBOL_GPL(crypto_acomp_decompress);
>
> +unsigned int crypto_acomp_batch_size(struct crypto_acomp *tfm)
> +{
> + if (acomp_is_async(tfm) &&
> + (crypto_comp_alg_common(tfm)->base.cra_type == &crypto_acomp_type)) {
> + struct acomp_alg *alg = crypto_acomp_alg(tfm);
> +
> + if (alg && alg->batch_size > 1)
> + return alg->batch_size;
> + }
> +
> + return 1;
> +}
> +EXPORT_SYMBOL_GPL(crypto_acomp_batch_size);
[Severity: Medium]
Should crypto_acomp_batch_size() check crypto_acomp_req_seg(tfm) instead of
acomp_is_async(tfm)?
crypto_acomp_compress() only dispatches segmented requests (where
req->unit_size is set) to tfm->compress(req) when crypto_acomp_req_seg(tfm) is
true, and otherwise sends them to acomp_do_req_chain(), which rejects
multi-segment requests (req->slen > req->unit_size) with -ENOSYS:
crypto/acompress.c:crypto_acomp_compress() {
...
if (req->unit_size && acomp_request_issg(req)) {
if (!crypto_acomp_req_seg(tfm))
return acomp_do_req_chain(req, true);
return tfm->compress(req);
}
...
}
If an asynchronous acomp_alg sets batch_size > 1 without CRYPTO_ALG_REQ_SEG,
crypto_acomp_batch_size() returns alg->batch_size and callers such as zswap
will submit multi-unit requests that fail with -ENOSYS. Conversely, because
base.cra_type == &crypto_acomp_type already distinguishes struct acomp_alg from
struct scomp_alg, requiring acomp_is_async(tfm) forces
crypto_acomp_batch_size() to return 1 for a synchronous acomp_alg even when it
sets CRYPTO_ALG_REQ_SEG and batch_size > 1.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120041906.5785-1-kanchanapsridhar2026@gmail.com?part=4
next prev parent reply other threads:[~2026-11-21 4:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 4:18 [PATCH v4 0/8] Batched zswap_store() framework with compression batching Kanchana P. Sridhar
2026-11-20 4:18 ` [PATCH v4 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-11-20 4:19 ` [PATCH v4 2/8] crypto: acomp - Add bit to indicate segmentation support Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 3/8] crypto: acomp - Add trivial segmentation wrapper Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 4/8] crypto: acomp - Add API to get a compression algorithm's batch-size Kanchana P. Sridhar
2026-11-21 4:20 ` sashiko-bot [this message]
2026-11-20 4:19 ` [PATCH v4 5/8] mm: zswap: Store the folio's node id in the zswap_entry Kanchana P. Sridhar
2026-11-20 22:46 ` Nhat Pham
2026-11-20 23:01 ` Kanchana P. Sridhar
2026-11-21 4:20 ` sashiko-bot
2026-11-20 4:19 ` [PATCH v4 6/8] mm: zswap: Store large folios in batches Kanchana P. Sridhar
2026-11-20 23:08 ` Nhat Pham
2026-11-20 23:40 ` Kanchana P. Sridhar
2026-11-20 23:25 ` Nhat Pham
2026-11-20 23:51 ` Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 7/8] mm: zswap: Refactor and optimize zswap_store_pages() batch operations Kanchana P. Sridhar
2026-11-20 23:45 ` Nhat Pham
2026-11-21 1:36 ` Kanchana P. Sridhar
2026-11-20 4:19 ` [PATCH v4 8/8] mm: zswap: Batched zswap_compress() for storing large folios in batches Kanchana P. Sridhar
2026-11-20 23:55 ` Nhat Pham
2026-11-21 1:17 ` Kanchana P. Sridhar
2026-11-21 3:24 ` Kanchana P. Sridhar
2026-11-21 4:20 ` sashiko-bot
2026-11-20 23:16 ` [PATCH v4 0/8] Batched zswap_store() framework with compression batching Nhat Pham
2026-11-21 1:04 ` 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=sashiko-outbox-226634@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=davem@davemloft.net \
--cc=hannes@cmpxchg.org \
--cc=herbert@gondor.apana.org.au \
--cc=kanchanapsridhar2026@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=rientjes@google.com \
--cc=sashiko-reviews@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.