From: Herbert Xu <herbert@gondor.apana.org.au>
To: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: shenyang39@huawei.com, wangzhou1@hisilicon.com,
davem@davemloft.net, jserv@ccns.ncku.edu.tw,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: hisilicon/zip - Optimize performance by replacing rw_lock with spinlock
Date: Fri, 30 Aug 2024 18:47:45 +0800 [thread overview]
Message-ID: <ZtGjUeJOy_-C7Gae@gondor.apana.org.au> (raw)
In-Reply-To: <20240823183856.561166-1-visitorckw@gmail.com>
On Sat, Aug 24, 2024 at 02:38:56AM +0800, Kuan-Wei Chiu wrote:
> The req_lock is currently implemented as a rw_lock, but there are no
> instances where read_lock() is called. This means that the lock is
> effectively only used by writers, making it functionally equivalent to
> a simple spinlock.
>
> As stated in Documentation/locking/spinlocks.rst:
> "Reader-writer locks require more atomic memory operations than simple
> spinlocks. Unless the reader critical section is long, you are better
> off just using spinlocks."
>
> Since the rw_lock in this case incurs additional atomic memory
> operations without any benefit from reader-writer locking, it is more
> efficient to replace it with a spinlock. This patch implements that
> replacement to optimize the driver's performance.
>
> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> ---
> Note: Build test only.
>
> drivers/crypto/hisilicon/zip/zip_crypto.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Patch applied. 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
prev parent reply other threads:[~2024-08-30 10:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 18:38 Kuan-Wei Chiu
2024-08-30 10:47 ` Herbert Xu [this message]
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=ZtGjUeJOy_-C7Gae@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shenyang39@huawei.com \
--cc=visitorckw@gmail.com \
--cc=wangzhou1@hisilicon.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®