public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ankit Jain <ankit-aj.jain@broadcom.com>
To: edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org
Cc: davem@davemloft.net, pabeni@redhat.com, ncardwell@google.com,
	kuniyu@google.com, horms@kernel.org, shuah@kernel.org,
	quic_subashab@quicinc.com, quic_stranche@quicinc.com,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	karen.badiryan@broadcom.com, ajay.kaher@broadcom.com,
	alexey.makhalov@broadcom.com,
	vamsi-krishna.brahmajosyula@broadcom.com, yin.ding@broadcom.com,
	tapas.kundu@broadcom.com, Ankit Jain <ankit-aj.jain@broadcom.com>
Subject: [PATCH net v2 0/2] tcp: protect locked SO_RCVBUF from Silly Window Syndrome
Date: Mon,  4 May 2026 14:49:43 +0000	[thread overview]
Message-ID: <20260504144945.13477-1-ankit-aj.jain@broadcom.com> (raw)

This series fixes a regression where locked SO_RCVBUF sockets suffer from
Silly Window Syndrome (SWS).

Recent memory fragmentation optimizations apply truesize penalties to the
scaling_ratio. For applications locking SO_RCVBUF (like Java/Tomcat) and
processing small packets, this drops the scaling_ratio to 1. This
collapses the advertised window and causes 504 Gateway Timeouts.

Patch 1 bypasses this penalty for locked buffers unless skb->len > advmss.
Patch 2 adds a packetdrill test.

Link to v1:
https://lore.kernel.org/all/20260427152756.1205-1-ankit-aj.jain@broadcom.com/

v1 -> v2:
 - Shifted protection from window_clamp to scaling_ratio based on Jakub
   Kicinski's feedback.
 - Added skb->len > advmss check to ensure large aggregate payloads (GRO)
   are still penalized. This allows tcp_rcv_neg_window.pkt to pass.
 - Added a new packetdrill test (Patch 2/2).

Testing:
 - Verified fix in a live Java/Tomcat environment (504 timeouts resolved).
 - Verified deadlock prevention via the new tcp_locked_rcvbuf_sws.pkt.
 - Passed upstream regression tests: tcp_rcv_neg_window.pkt,
   tcp_rcv_wnd_shrink_allowed.pkt, tcp_rcv_wnd_shrink_nomem.pkt,
   tcp_rcv_zero_wnd_fin.pkt, and tcp_rcv_big_endseq.pkt.

Ankit Jain (2):
  tcp: protect locked SO_RCVBUF from Silly Window Syndrome
  selftests/net: add packetdrill test for locked SO_RCVBUF SWS

 net/ipv4/tcp_input.c                          |  8 ++++-
 .../net/packetdrill/tcp_locked_rcvbuf_sws.pkt | 34 +++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/net/packetdrill/tcp_locked_rcvbuf_sws.pkt

--
2.53.0


             reply	other threads:[~2026-05-04 14:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 14:49 Ankit Jain [this message]
2026-05-04 14:49 ` [PATCH net v2 1/2] tcp: protect locked SO_RCVBUF from Silly Window Syndrome Ankit Jain
2026-05-04 16:09   ` Eric Dumazet
2026-05-05 18:19     ` Ankit Jain
2026-05-04 14:49 ` [PATCH net v2 2/2] selftests/net: add packetdrill test for locked SO_RCVBUF SWS Ankit Jain
2026-05-04 16:13   ` Eric Dumazet
2026-05-05 18:23     ` Ankit Jain

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=20260504144945.13477-1-ankit-aj.jain@broadcom.com \
    --to=ankit-aj.jain@broadcom.com \
    --cc=ajay.kaher@broadcom.com \
    --cc=alexey.makhalov@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=karen.badiryan@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_stranche@quicinc.com \
    --cc=quic_subashab@quicinc.com \
    --cc=shuah@kernel.org \
    --cc=tapas.kundu@broadcom.com \
    --cc=vamsi-krishna.brahmajosyula@broadcom.com \
    --cc=yin.ding@broadcom.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