From: Herbert Xu <herbert@gondor.apana.org.au>
To: Robert Elliott <elliott@hpe.com>
Cc: davem@davemloft.net, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] crypto: skcipher - always yield at end of walk
Date: Tue, 20 Dec 2022 11:54:06 +0800 [thread overview]
Message-ID: <Y6Ex3qhftA/jXVUS@gondor.apana.org.au> (raw)
In-Reply-To: <20221219203733.3063192-2-elliott@hpe.com>
On Mon, Dec 19, 2022 at 02:37:31PM -0600, Robert Elliott wrote:
>
> diff --git a/crypto/skcipher.c b/crypto/skcipher.c
> index 0ecab31cfe79..cdead632117a 100644
> --- a/crypto/skcipher.c
> +++ b/crypto/skcipher.c
> @@ -153,13 +153,20 @@ int skcipher_walk_done(struct skcipher_walk *walk, int err)
> scatterwalk_done(&walk->in, 0, nbytes);
> scatterwalk_done(&walk->out, 1, nbytes);
>
> - if (nbytes) {
> - crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ?
> - CRYPTO_TFM_REQ_MAY_SLEEP : 0);
> + /*
> + * Allow scheduler to use the CPU since it has been busy,
> + * regardless of whether another loop pass is due
> + */
> + crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ?
> + CRYPTO_TFM_REQ_MAY_SLEEP : 0);
> +
> + if (nbytes)
> return skcipher_walk_next(walk);
> - }
>
> finish:
> + crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ?
> + CRYPTO_TFM_REQ_MAY_SLEEP : 0);
> +
You're calling crypto_yield twice if nbytes == 0. How about
deleting the second crypto_yield call because the only case
where it would matter is when n == 0.
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:[~2022-12-20 3:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 20:37 [PATCH 0/3] crypto: yield at end of operations Robert Elliott
2022-12-19 20:37 ` [PATCH 1/3] crypto: skcipher - always yield at end of walk Robert Elliott
2022-12-20 3:54 ` Herbert Xu [this message]
2022-12-19 20:37 ` [PATCH 2/3] crypto: aead/shash - yield at end of operations Robert Elliott
2022-12-20 3:55 ` Herbert Xu
2022-12-19 20:37 ` [PATCH 3/3] crypto: tcrypt - yield at end of test Robert Elliott
2022-12-20 3:55 ` 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=Y6Ex3qhftA/jXVUS@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=elliott@hpe.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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