Re: [PATCH mptcp-next 2/3] mptcp: sched: do not penalise when receive-window-limited

Matthieu Baerts <[email protected]> Wed, 29 Jul 2026 13:49:48 +0200
Newsgroups dev.linux.lists.mptcp
Organization NGI0 Core
Message-ID <[email protected]>
Hi Shardul,

On 26/07/2026 07:55, Shardul Bankar wrote:
> 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.

(a bit too long, some text can probably be moved to the commit message
if not there already → but also, I guess this commit will be squashed in
the previous one at the end)

> + */
> +static bool mptcp_penalise_send_window_ok(const struct mptcp_sock *msk)
> +{
> +	return msk->write_seq <= mptcp_wnd_end(msk);

It looks like you are doing something similar to tcp_snd_wnd_test(), no?

I guess you should at least use after64/before64. Here we don't have the
skb, that might change later if the MPTCP scheduler API is modified, but
that can be an optimisation for later.

You could name the helper mptcp_snd_wnd_test(), and mention it is
inspired by the TCP version, but without checking the packet len (for
the moment).

Other than that, this Sashiko's comment is interesting:

> Does this heuristic correctly identify receive-window bottlenecks without
> unintentionally disabling the penalty for congestion-limited bulk transfers?
> Because write_seq is limited by the socket send buffer (sk_sndbuf) rather
> than the congestion window, an application performing a bulk transfer with a
> large send buffer can easily queue data past the peer's advertised receive
> window.
> If the connection is heavily congestion-limited, the fast path is saturated
> and the slow path should still be penalized to reduce head-of-line blocking.
> However, since write_seq > mptcp_wnd_end(msk) in this scenario, it seems
> this check will incorrectly assume the connection is receive-window limited
> and skip the penalty.

By chance, did you already validate this case?

> +}
> +
>  /* 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);
> 

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.