Re: [PATCH net-next v6 2/2] net/smc: handle -ENOMEM from smc_wr_alloc_link_mem gracefully

Mahanta Jambigi
2025-10-28T09:34:19Z

On 28/10/25 4:18 am, Halil Pasic wrote:
> 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>