• Kuan-Wei Chiu's avatar
    crypto: hisilicon/zip - Optimize performance by replacing rw_lock with spinlock · be9c3368
    Kuan-Wei Chiu authored
    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: default avatarKuan-Wei Chiu <visitorckw@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    be9c3368
zip_crypto.c 15.5 KB