Re: [PATCH v7] crypto: scompress: remove memcpy if sg_nents is 1 and pages are lowmem

From: Guenter Roeck
Date: Sun Mar 17 2024 - 19:13:58 EST


Hi,

On Sat, Mar 02, 2024 at 08:27:45AM +1300, Barry Song wrote:
[ ... ]
> @@ -152,8 +165,17 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
> ret = -ENOSPC;
> goto out;
> }
> - scatterwalk_map_and_copy(scratch->dst, req->dst, 0, req->dlen,
> - 1);
> + if (dst == scratch->dst) {
> + scatterwalk_map_and_copy(scratch->dst, req->dst, 0,
> + req->dlen, 1);
> + } else {
> + int nr_pages = DIV_ROUND_UP(req->dst->offset + req->dlen, PAGE_SIZE);
> + int i;
> + struct page *dst_page = sg_page(req->dst);
> +
> + for (i = 0; i < nr_pages; i++)
> + flush_dcache_page(dst_page + i);

flush_dcache_page() is an empty macro on some architectures
such as xtensa. This results in

Building xtensa:allmodconfig ... failed
--------------
Error log:
crypto/scompress.c: In function 'scomp_acomp_comp_decomp':
crypto/scompress.c:174:38: error: unused variable 'dst_page'

on the affected architectures.

Guenter