net/smc: replace mutex rmbs_lock and sndbufs_lock with rw_semaphore
authorD. Wythe <alibuda@linux.alibaba.com>
Thu, 2 Feb 2023 08:26:42 +0000 (16:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 Feb 2023 09:48:19 +0000 (09:48 +0000)
commitaff7bfed9097435ea38de919befbe2d7771a3e87
treec16906013868a13495e55a16f63946d7d4f5f4bc
parent4da687448de7b51dcca9d024c6049fa223f5363f
net/smc: replace mutex rmbs_lock and sndbufs_lock with rw_semaphore

It's clear that rmbs_lock and sndbufs_lock are aims to protect the
rmbs list or the sndbufs list.

During connection establieshment, smc_buf_get_slot() will always
be invoked, and it only performs read semantics in rmbs list and
sndbufs list.

Based on the above considerations, we replace mutex with rw_semaphore.
Only smc_buf_get_slot() use down_read() to allow smc_buf_get_slot()
run concurrently, other part use down_write() to keep exclusive
semantics.

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_core.c
net/smc/smc_core.h
net/smc/smc_llc.c