Linux cryptographic layer development
 help / color / mirror / Atom feed
From: "Cabiddu, Giovanni" <giovanni.cabiddu@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>,
	<linux-crypto@vger.kernel.org>, <qat-linux@intel.com>,
	<dsterba@suse.com>, <terrelln@fb.com>,
	<clabbe.montjoie@gmail.com>
Subject: Re: [v2] crypto: zstd - convert to acomp
Date: Thu, 22 May 2025 10:05:06 +0100	[thread overview]
Message-ID: <aC7owoGDFl5YVVxP@gcabiddu-mobl.ger.corp.intel.com> (raw)
In-Reply-To: <aC2I0_F2BJbexte4@gondor.apana.org.au>

On Wed, May 21, 2025 at 04:03:31PM +0800, Herbert Xu wrote:
> On Wed, May 21, 2025 at 07:41:11AM +0100, Suman Kumar Chakraborty wrote:
> >
> > +	if ((sg_nents(req->src) == 1) && (sg_nents(req->dst) == 1)) {
> > +		ret = zstd_compress_one(req, ctx, &total_out);
> > +		goto out;
> 
> This isn't right.  Even if the SG list is a singleton, it could
> consist of multiple pages in highmem.
> 
> What's worse, if src and dst are in fact linear, then you're
> dereferencing bogus pointers.
> 
> Just get rid of this optimisation unless you've got numbers
> proving that it makes a difference.
Without this optimization the performance drop is significant, compared
to the original implementation based on scomp. About -40% using
compressible data and 4KB flat buffers.

Is it an option to check if the SG list consists of multiple pages in
highmem like it was in scomp [1]?

Thanks,

[1] https://elixir.bootlin.com/linux/v6.14.7/source/crypto/scompress.c#L138

-- 
Giovanni

  reply	other threads:[~2025-05-22  9:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21  6:41 [v2] crypto: zstd - convert to acomp Suman Kumar Chakraborty
2025-05-21  8:03 ` Herbert Xu
2025-05-22  9:05   ` Cabiddu, Giovanni [this message]
2025-05-22  9:07     ` Herbert Xu
2025-05-26  9:48       ` Herbert Xu

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=aC7owoGDFl5YVVxP@gcabiddu-mobl.ger.corp.intel.com \
    --to=giovanni.cabiddu@intel.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=dsterba@suse.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=suman.kumar.chakraborty@intel.com \
    --cc=terrelln@fb.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