[PATCH mptcp-next 2/3] mptcp: sched: do not penalise when receive-window-limited
Shardul Bankar <[email protected]> Sun, 26 Jul 2026 11:25:40 +0530
| Newsgroups | dev.linux.lists.mptcp |
|---|---|
| Message-ID | <20260726-mptcp_penalise_send-v1-2-84485e0e995b@mpiricsoftware.com> |
The penalty in the previous patch shifts load off a slow subflow onto the fastest one, which only helps if the fastest path can absorb it. When the connection is receive-window-limited (the receiver's advertised window, not our congestion window, is the bottleneck), the fastest path is capped by that shared window too and cannot send more, so halving the slow path's cwnd just sheds its throughput. In a receive-window-limited transfer this was measured roughly 2x slower than baseline. Gate on the application's queued data fitting within the send window: penalise only while write_seq <= wnd_end. If the application has queued past the window edge the receive window is the binding constraint, so skip the penalty. Both write_seq (application demand) and wnd_end (peer window) are standing values and neither is derived from cwnd, so the test is not biased by the scheduler sampling just after an ACK opened the window, nor made circular by the window itself suppressing cwnd. Co-developed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Shardul Bankar <[email protected]> --- net/mptcp/protocol.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index d31bcb9ad894..7cbc5aa17e22 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1575,6 +1575,23 @@ static bool mptcp_penalise_throttle_ok(struct mptcp_subflow_context *subflow) return tcp_jiffies32 - subflow->last_penalise >= max_t(u32, rtt, 1); } +/* Only penalise when the connection is not receive-window-limited: all the + * data the application has queued fits within the current send window + * (write_seq <= wnd_end). If it has queued past the window edge, the peer's + * receive window (not our congestion window) is the bottleneck: the fast + * path is capped by that shared window too and cannot use capacity freed from + * the slow path, so penalising would only shed the slow path's throughput. + * + * write_seq (application demand) and wnd_end (peer-advertised window) are both + * standing values and neither is derived from cwnd, so unlike the instantaneous + * window headroom this is not biased by the scheduler sampling just after an + * ACK opened the window, nor circular when the window is what suppresses cwnd. + */ +static bool mptcp_penalise_send_window_ok(const struct mptcp_sock *msk) +{ + return msk->write_seq <= mptcp_wnd_end(msk); +} + /* Halve the congestion window (and ssthresh, if cwnd is past it) of a subflow * the scheduler flagged. Runs in the push path under the subflow socket lock, * which protects snd_cwnd. The congestion control grows the window back, @@ -1681,6 +1698,7 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) (u64)subflow->avg_pacing_rate * MPTCP_PENALISE_RATE_RATIO < max_pace && inet_csk(ssk)->icsk_ca_state == TCP_CA_Open && tcp_is_cwnd_limited(fastest) && + mptcp_penalise_send_window_ok(msk) && mptcp_penalise_throttle_ok(subflow); burst = min(MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); -- 2.34.1