net/smc: reduce unnecessary blocking in smcr_lgr_reg_rmbs()
authorD. Wythe <alibuda@linux.alibaba.com>
Thu, 2 Feb 2023 08:26:41 +0000 (16:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 Feb 2023 09:48:19 +0000 (09:48 +0000)
commit4da687448de7b51dcca9d024c6049fa223f5363f
tree22cc36871439c81d4867f08ae90d789f84e74853
parentf6421014e88983c5bb7a25c71c01ae6278a01df9
net/smc: reduce unnecessary blocking in smcr_lgr_reg_rmbs()

Unlike smc_buf_create() and smcr_buf_unuse(), smcr_lgr_reg_rmbs() is
exclusive when assigned rmb_desc was not registered, although it can be
executed in parallel when assigned rmb_desc was registered already
and only performs read semtamics on it. Hence, we can not simply replace
it with read semaphore.

The idea here is that if the assigned rmb_desc was registered already,
use read semaphore to protect the critical section, once the assigned
rmb_desc was not registered, keep using keep write semaphore still
to keep its exclusivity.

Thanks to the reusable features of rmb_desc, which allows us to execute
in parallel in most cases.

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