From: Halil Pasic <pasic@linux.ibm.com>
To: Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
"D. Wythe" <alibuda@linux.alibaba.com>,
Dust Li <dust.li@linux.alibaba.com>,
Sidraya Jayagond <sidraya@linux.ibm.com>,
Wenjia Zhang <wenjia@linux.ibm.com>,
Mahanta Jambigi <mjambigi@linux.ibm.com>,
Tony Lu <tonylu@linux.alibaba.com>,
Wen Gu <guwen@linux.alibaba.com>,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-s390@vger.kernel.org
Cc: Halil Pasic <pasic@linux.ibm.com>
Subject: [PATCH net-next v3 0/2] net/smc: make wr buffer count configurable
Date: Sun, 21 Sep 2025 23:44:38 +0200 [thread overview]
Message-ID: <20250921214440.325325-1-pasic@linux.ibm.com> (raw)
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:
---------
v3:
1) Renamed back sysctls from smcr_pref_*_wr to smcr_max_*_wr (Dust Li)
2) Using link->wr_rx_buflen instead of SMC_WR_BUF_SIZE when allocating
wr_rx_bufs to not break what was fixed with
commit 27ef6a9981fe ("net/smc: support SMC-R V2 for rdma devices
with max_recv_sge equals to 1") (Dust Li)
3) Removed unwanted 'this control' in the documentation in #1
(Dust Li)
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 | 7 ++---
net/smc/smc_llc.c | 2 ++
net/smc/smc_sysctl.c | 22 ++++++++++++++
net/smc/smc_sysctl.h | 2 ++
net/smc/smc_wr.c | 32 ++++++++++----------
net/smc/smc_wr.h | 2 --
10 files changed, 119 insertions(+), 32 deletions(-)
base-commit: 312e6f7676e63bbb9b81e5c68e580a9f776cc6f0
--
2.48.1
next reply other threads:[~2025-09-21 21:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-21 21:44 Halil Pasic [this message]
2025-09-21 21:44 ` [PATCH net-next v3 1/2] net/smc: make wr buffer count configurable Halil Pasic
2025-09-24 17:27 ` Sidraya Jayagond
2025-09-25 9:27 ` Paolo Abeni
2025-09-25 11:25 ` Halil Pasic
2025-09-27 22:55 ` Halil Pasic
2025-09-28 2:02 ` Dust Li
2025-09-28 2:12 ` Dust Li
2025-09-28 8:39 ` Halil Pasic
2025-09-28 11:42 ` Dust Li
2025-09-28 18:32 ` Halil Pasic
2025-09-26 2:44 ` Guangguan Wang
2025-09-26 10:12 ` Halil Pasic
2025-09-26 10:30 ` Halil Pasic
2025-09-28 3:05 ` Guangguan Wang
2025-09-21 21:44 ` [PATCH net-next v3 2/2] net/smc: handle -ENOMEM from smc_wr_alloc_link_mem gracefully Halil Pasic
2025-09-24 17:28 ` Sidraya Jayagond
2025-09-25 9:40 ` Paolo Abeni
2025-09-25 15:05 ` Halil Pasic
2025-09-25 15:41 ` Paolo Abeni
2025-09-25 21:46 ` Halil Pasic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250921214440.325325-1-pasic@linux.ibm.com \
--to=pasic@linux.ibm.com \
--cc=alibuda@linux.alibaba.com \
--cc=dust.li@linux.alibaba.com \
--cc=guwen@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjambigi@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
--cc=wenjia@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).