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

From: Mahanta Jambigi

Date: Tue Oct 28 2025 - 05:34:19 EST




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@xxxxxxxxxxxxx>
> Reviewed-by: Wenjia Zhang <wenjia@xxxxxxxxxxxxx>
> Reviewed-by: Mahanta Jambigi <mjambigi@xxxxxxxxxxxxx>
> Reviewed-by: Sidraya Jayagond <sidraya@xxxxxxxxxxxxx>
> Reviewed-by: Dust Li <dust.li@xxxxxxxxxxxxxxxxx>


Tested-by: Mahanta Jambigi <mjambigi@xxxxxxxxxxxxx>