From: Herbert Xu <herbert@gondor.apana.org.au>
To: Barry Song <21cnbao@gmail.com>
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
hannes@cmpxchg.org, chriscli@google.com, chrisl@kernel.org,
sjenning@redhat.com, vitaly.wool@konsulko.com,
Barry Song <v-songbaohua@oppo.com>, Nhat Pham <nphamcs@gmail.com>,
Yosry Ahmed <yosryahmed@google.com>,
Chengming Zhou <zhouchengming@bytedance.com>,
Matthew Wilcox <willy@infradead.org>,
Kent Overstreet <kent.overstreet@linux.dev>,
"Darrick J. Wong" <djwong@kernel.org>,
Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v6] crypto: scompress: remove memcpy if sg_nents is 1 and pages are lowmem
Date: Fri, 1 Mar 2024 18:27:58 +0800 [thread overview]
Message-ID: <ZeGtrvm9WGv5cxQV@gondor.apana.org.au> (raw)
In-Reply-To: <20240222020617.31041-1-21cnbao@gmail.com>
On Thu, Feb 22, 2024 at 03:06:17PM +1300, Barry Song wrote:
>
> - scatterwalk_map_and_copy(scratch->src, req->src, 0, req->slen, 0);
> + if (sg_nents(req->src) == 1 && !PageHighMem(sg_page(req->src))) {
> + src = page_to_virt(sg_page(req->src)) + req->src->offset;
Incidentally this made me look at other uses of PageHighMem in
the kernel.
The one in copy_page_from_iter_atomic looks buggy because it assumes
that the kmap never maps a page if PageHighMem is false, which is not
the case for CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP.
> @@ -152,8 +165,12 @@ 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 {
> + flush_dcache_page(sg_page(req->dst));
I think this is still wrong for the > PAGE_SIZE case. The existing
code flushes each page sequentially but the new code only flushes the
first page.
Thanks,
--
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
next prev parent reply other threads:[~2024-03-01 10:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-22 2:06 Barry Song
2024-03-01 10:27 ` Herbert Xu [this message]
2024-03-01 11:17 ` Barry Song
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=ZeGtrvm9WGv5cxQV@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chriscli@google.com \
--cc=chrisl@kernel.org \
--cc=davem@davemloft.net \
--cc=djwong@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hch@lst.de \
--cc=kent.overstreet@linux.dev \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=sjenning@redhat.com \
--cc=v-songbaohua@oppo.com \
--cc=viro@zeniv.linux.org.uk \
--cc=vitaly.wool@konsulko.com \
--cc=willy@infradead.org \
--cc=yosryahmed@google.com \
--cc=zhouchengming@bytedance.com \
/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®