[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4wf+PF-HVnyARTuAhS4bEe-SZ_pSKzPLp2YQcHp4Aftiw@mail.gmail.com>
Date: Fri, 16 Feb 2024 16:49:19 +1300
From: Barry Song <21cnbao@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: davem@...emloft.net, akpm@...ux-foundation.org, ddstreet@...e.org,
sjenning@...hat.com, vitaly.wool@...sulko.com, linux-crypto@...r.kernel.org,
chriscli@...gle.com, chrisl@...nel.org, hannes@...xchg.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, nphamcs@...il.com,
yosryahmed@...gle.com, zhouchengming@...edance.com,
Barry Song <v-songbaohua@...o.com>
Subject: Re: [PATCH 3/3] crypto: scompress: remove memcpy if sg_nents is 1
On Thu, Jan 25, 2024 at 10:58 PM Herbert Xu <herbert@...dor.apana.org.au> wrote:
>
> On Wed, Jan 03, 2024 at 10:50:06PM +1300, Barry Song wrote:
> >
> > + if (dst != scratch->dst)
> > + kunmap_local(dst);
>
> This is missing a flush_dcache_page.
Thanks, Herbert! I'd rather add flush_dcache_page()
to the below place so that we can avoid one redundant
flush for ENOSPC/ENOMEM case:
if (!ret) {
if (!req->dst) {
req->dst = sgl_alloc(req->dlen, GFP_ATOMIC, NULL);
if (!req->dst) {
ret = -ENOMEM;
goto out;
}
} else if (req->dlen > dlen) {
ret = -ENOSPC;
goto out;
}
if (dst == scratch->dst) {
scatterwalk_map_and_copy(scratch->dst, req->dst, 0,
req->dlen, 1);
} else {
+ flush_dcache_page(sg_page(req->dst));
}
}
out:
if (src != scratch->src)
kunmap_local(src);
if (dst != scratch->dst)
kunmap_local(dst);
>
> It may not matter for zswap, but this is API code and needs to
> work for every single case.
>
> Thanks,
> --
> Email: Herbert Xu <herbert@...dor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
Thanks
Barry
Powered by blists - more mailing lists