[PATCH net-next v4 0/2] net/smc: make wr buffer count configurable

Halil Pasic posted 2 patches 3 days, 21 hours ago
There is a newer version of this series
Documentation/networking/smc-sysctl.rst | 40 +++++++++++++++++++++++++
include/net/netns/smc.h                 |  2 ++
net/smc/smc_core.c                      | 34 ++++++++++++++-------
net/smc/smc_core.h                      |  8 +++++
net/smc/smc_ib.c                        |  8 ++---
net/smc/smc_llc.c                       |  2 ++
net/smc/smc_sysctl.c                    | 22 ++++++++++++++
net/smc/smc_sysctl.h                    |  2 ++
net/smc/smc_wr.c                        | 31 +++++++++----------
net/smc/smc_wr.h                        |  2 --
10 files changed, 119 insertions(+), 32 deletions(-)
[PATCH net-next v4 0/2] net/smc: make wr buffer count configurable
Posted by Halil Pasic 3 days, 21 hours ago
The current value of SMC_WR_BUF_CNT is 16 which leads to heavy
contention on the wr_tx_wait workqueue of the SMC-R linkgroup and its
spinlock when many connections are competing for the work request
buffers. Currently up to 256 connections per linkgroup are supported.

To make things worse when finally a buffer becomes available and
smc_wr_tx_put_slot() signals the linkgroup's wr_tx_wait wq, because
WQ_FLAG_EXCLUSIVE is not used all the waiters get woken up, most of the
time a single one can proceed, and the rest is contending on the
spinlock of the wq to go to sleep again.

Addressing this by simply bumping SMC_WR_BUF_CNT to 256 was deemed
risky, because the large-ish physically continuous allocation could fail
and lead to TCP fall-backs. For reference see this discussion thread on
"[PATCH net-next] net/smc: increase SMC_WR_BUF_CNT" (in archive
https://lists.openwall.net/netdev/2024/11/05/186), which concludes with
the agreement to try to come up with something smarter, which is what
this series aims for.

Additionally if for some reason it is known that heavy contention is not
to be expected going with something like 256 work request buffers is
wasteful. To address these concerns make the number of work requests
configurable, and introduce a back-off logic with handles -ENOMEM form
smc_wr_alloc_link_mem() gracefully.
---

Changelog:
---------
v4:
 * Fix ungrammatical sentences in smc-sysctl.rst (Paolo)
 * Remove unrelated whitespce change (Paolo)
 * Add comment on qp_attr.cap.max_send__wr (Paolo)
 * Reword commit messages (Paolo)
 * Add r-b's by Sid 
v3: https://lore.kernel.org/netdev/20250921214440.325325-1-pasic@linux.ibm.com/
v2: https://lore.kernel.org/netdev/20250908220150.3329433-1-pasic@linux.ibm.com/
v1: https://lore.kernel.org/all/20250904211254.1057445-1-pasic@linux.ibm.com/


Halil Pasic (2):
  net/smc: make wr buffer count configurable
  net/smc: handle -ENOMEM from smc_wr_alloc_link_mem gracefully

 Documentation/networking/smc-sysctl.rst | 40 +++++++++++++++++++++++++
 include/net/netns/smc.h                 |  2 ++
 net/smc/smc_core.c                      | 34 ++++++++++++++-------
 net/smc/smc_core.h                      |  8 +++++
 net/smc/smc_ib.c                        |  8 ++---
 net/smc/smc_llc.c                       |  2 ++
 net/smc/smc_sysctl.c                    | 22 ++++++++++++++
 net/smc/smc_sysctl.h                    |  2 ++
 net/smc/smc_wr.c                        | 31 +++++++++----------
 net/smc/smc_wr.h                        |  2 --
 10 files changed, 119 insertions(+), 32 deletions(-)


base-commit: e835faaed2f80ee8652f59a54703edceab04f0d9
-- 
2.48.1
Re: [PATCH net-next v4 0/2] net/smc: make wr buffer count configurable
Posted by Halil Pasic 2 days, 20 hours ago
On Sun, 28 Sep 2025 01:21:42 +0200
Halil Pasic <pasic@linux.ibm.com> wrote:

> Changelog:
> ---------
> v4:
>  * Fix ungrammatical sentences in smc-sysctl.rst (Paolo)
>  * Remove unrelated whitespce change (Paolo)
>  * Add comment on qp_attr.cap.max_send__wr (Paolo)
>  * Reword commit messages (Paolo)
>  * Add r-b's by Sid

Based on comments from Dust Li on the v3 thread I have sent out
a v5 just now. So this is now superseded by v5 although the above
change log may still be of some interest.

Regards,
Halil