]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/smc: handle -ENOMEM from smc_wr_alloc_link_mem gracefully
authorHalil Pasic <pasic@linux.ibm.com>
Mon, 27 Oct 2025 22:48:56 +0000 (23:48 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 30 Oct 2025 12:31:43 +0000 (13:31 +0100)
commit8f736087e52f1cd4234b871c137f5a3eb0d2741a
tree5bb6587dbe595fd8c494eff0d7b4a22b2b4f7c7e
parentaef3cdb47bbbef9fea9512ed6c02d64394449d53
net/smc: handle -ENOMEM from smc_wr_alloc_link_mem gracefully

Currently if a -ENOMEM from smc_wr_alloc_link_mem() is handled by
giving up and going the way of a TCP fallback. This was reasonable
before the sizes of the allocations there were compile time constants
and reasonably small. But now those are actually configurable.

So instead of giving up, keep retrying with half of the requested size
unless we dip below the old static sizes -- then give up! In terms of
numbers that means we give up when it is certain that we at best would
end up allocating less than 16 send WR buffers or less than 48 recv WR
buffers. This is to avoid regressions due to having fewer buffers
compared the static values of the past.

Please note that SMC-R is supposed to be an optimisation over TCP, and
falling back to TCP is superior to establishing an SMC connection that
is going to perform worse. If the memory allocation fails (and we
propagate -ENOMEM), we fall back to TCP.

Preserve (modulo truncation) the ratio of send/recv WR buffer counts.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Reviewed-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Tested-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Link: https://patch.msgid.link/20251027224856.2970019-3-pasic@linux.ibm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Documentation/networking/smc-sysctl.rst
net/smc/smc_core.c
net/smc/smc_core.h
net/smc/smc_wr.c