]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: hisilicon/zip - Optimize performance by replacing rw_lock with spinlock
authorKuan-Wei Chiu <visitorckw@gmail.com>
Fri, 23 Aug 2024 18:38:56 +0000 (02:38 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Aug 2024 10:23:43 +0000 (18:23 +0800)
commitbe9c336852056e2c34369de79fd938dc21a2d5cf
tree416a9b8ff31a027320ee489e39a7153b839ffba3
parent407f8cf8e6875fc8fb3c0cda193f310340122060
crypto: hisilicon/zip - Optimize performance by replacing rw_lock with spinlock

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/zip/zip_crypto.c