On Thu, May 7, 2026 at 8:51 AM Ankit Jain <[email protected]> wrote:
>
> When an application locks SO_RCVBUF, it disables TCP window auto-tuning.
> However, the kernel still applies dynamic truesize penalties to the
> scaling_ratio.
>
> For small packets, this penalty drops the scaling_ratio to 1. This
> reduces the advertised window and causes Silly Window Syndrome (SWS)
> along with 504 Gateway Timeouts in applications like Tomcat.
>
> This patch bypasses the truesize penalty if SOCK_RCVBUF_LOCK is set.
> To prevent memory exhaustion from large aggregate payloads, the penalty
> is still applied for GRO packets (skb->len > len).
>
> Fixes: a2cbb1603943 ("tcp: Update window clamping condition")
> Reported-by: Karen Badiryan <[email protected]>
> Signed-off-by: Ankit Jain <[email protected]>

I still do not see why the current behavior has a 'bug'. I think it is
quite sane/reasonable.

Your selftest does not show anything wrong IMO.

If you want to avoid SWS, perhaps the application needs to _not_ use
SO_RCVBUF with a value smaller than the device MTU?

Applications using SO_RCVBUF with tiny values can not expect kernel
behavior to be stable,
since rcvbuf management depends on metadata size, which can vary
between kernels versions/options.

If  a kernel change is needed, I would rather enforce a sane sk_rcvbuf
floor when the MSS is learnt
at accept()/connect() time.

( TCP_SKB_MIN_TRUESIZE / SOCK_MIN_RCVBUF definitions )

Reply via email to