Re: [PATCH v11 00/24] zswap compression batching with optimized iaa_crypto driver

From: Herbert Xu
Date: Tue Aug 26 2025 - 00:15:40 EST


On Tue, Aug 26, 2025 at 04:09:45AM +0000, Sridhar, Kanchana P wrote:
>
> Thanks Herbert. Just want to make sure I understand this. Are you
> referring to replacing sg_set_page() for the input with sg_set_folio()?
> We have to pass in a scatterlist for the acomp_req->src..

I'm talking about acomp_request_set_src_folio. You can pass just
a portion of a folio by specifying an offset and a length.

> for (i = 0; i < nr_pages; i += nr_comps) {
> for_each_sg(acomp_ctx->sg_inputs->sgl, sg, nr_comps, k)
> sg_set_folio(sg, folio, PAGE_SIZE, (start + k + i) * PAGE_SIZE);
>
> /*
> * We need PAGE_SIZE * 2 here since there maybe over-compression case,
> * and hardware-accelerators may won't check the dst buffer size, so
> * giving the dst buffer with enough length to avoid buffer overflow.
> */
> for_each_sg(acomp_ctx->sg_outputs->sgl, sg, nr_comps, k)
> sg_set_buf(sg, acomp_ctx->buffers[k], PAGE_SIZE * 2);
>
> acomp_request_set_params(acomp_ctx->req,
> acomp_ctx->sg_inputs->sgl,
> acomp_ctx->sg_outputs->sgl,
> nr_comps * PAGE_SIZE,
> nr_comps * PAGE_SIZE);

I meant something more like:

acomp_request_set_src_folio(req, folio, start_offset,
nr_comps * PAGE_SIZE);
acomp_request_set_dst_sg(req, acomp_ctx_sg_outputs->sgl,
nr_comps * PAGE_SIZE);
acomp_request_set_unit_size(req, PAGE_SIZE);

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