[PATCH mptcp-next 0/3] mptcp: sched: penalise a slow subflow (#345, first cut for your lab)
Shardul Bankar <[email protected]> Sun, 26 Jul 2026 11:25:38 +0530
| Newsgroups | dev.linux.lists.mptcp |
|---|---|
| Message-ID | <20260726-mptcp_penalise_send-v1-0-84485e0e995b@mpiricsoftware.com> |
Hi Matt, Following up on my note about aligning #345 to mptcp_rcv_buf_optimization(): here is a first cut, as a 3-patch series. A few things came out differently from what I described there, so I have called each one out below rather than leave it for you to spot. 1/3 penalise a slow subflow by halving its cwnd 2/3 do not penalise when receive-window-limited 3/3 DO-NOT-MERGE counters (for testing only) 1/3 is the simple version. In the scheduler, once a subflow is picked, it is flagged for a cwnd halving that is applied in the push path under the subflow socket lock (so it is safe with the per-subflow locks, as I mentioned). The flag is set when the subflow is clearly slower than the fastest path, the fastest path is cwnd-limited, and the subflow is in TCP_CA_Open. The reduction halves cwnd (and ssthresh if cwnd is past it), at most once per RTT, and the congestion control grows it back. What differs from what I described, and why: - Trigger on delivery rate, not RTT. I had said "slower by RTT". In testing that over-penalised a path that is only higher latency but still carries its share of the traffic (equal bandwidth, unequal delay): it fires on the slower-by-latency path even though shrinking its window loses real goodput. Keying on the pacing rate instead (penalise only a path whose rate is below half the fastest) targets a genuinely low-throughput path, and reuses the avg_pacing_rate the scheduler already maintains. On the threshold I raised with you (the fork's "any slower" versus a small factor): I had said I would default to "any slower", but with a rate trigger that fires on almost every non-fastest path, since rates always vary a little, so I used the factor to keep it to genuinely slow paths, as I flagged might be needed. Half is just a starting point, easy to tune. - I did not carry over the fork's "meta is send-buffer-limited" gate. In mainline the msk send buffer is the sum of the subflow send buffers, and it is effectively never full when the scheduler samples it (the scheduler runs on the push path, just after an ACK has opened room), so that gate never fires and the penalty stays dormant. That is why 1/3 has no send-buffer condition. - 2/3 is a guard that is in neither the fork nor what I described. Without it, 1/3 regresses badly (about 2x slower in my runs) when the connection is receive-window-limited. In that case the fastest path is capped by the same shared window, so it cannot absorb what the slow path gives up, and halving just sheds the slow path's throughput. 2/3 skips the penalty while the application has queued past the send-window edge (write_seq > wnd_end), which is the sign that the receiver, not our congestion window, is the bottleneck. I kept it a separate patch so you can test 1/3 on its own, or drop or retune 2/3 independently. The exact condition is the piece I would most value your lab checking. Testing was local (network namespaces plus netem, patched against a clean mptcp/export), starting from the existing simult_flows selftest. It is a debug kernel and mostly single runs, so please read the numbers as directional; I am happy to share the full logs and the scenario script. - No regression on the simult_flows suite. - To see the intended effect I looked at MPTcpExtOFOQueue, the number of segments the receiver had to hold out of order over the transfer, since that is what the change is meant to reduce and a plain throughput number cannot show it. On the asymmetric-bandwidth pair (10 vs 3 mbit) with a small SO_SNDBUF, that count fell by roughly a fifth (about 18 to 23% in my runs) with no change in throughput. So this is a reduction in reordering, i.e. a latency and smoothness effect, not more bytes per second; whether that is worth it for a real workload is exactly what I hope your lab can judge. - The receive-window-limited regression above is back to baseline with 2/3. - Two honest limits. First, with fully autotuned buffers (the common default) the guard does not fire, because the connection is not receive-window- limited, and the penalty then leaves a small reordering cost: halving trims the slow path's delivery rate, so its share of the in-order stream arrives a little later and the out-of-order count rises a few percent. I did not find a simple way to also suppress that without re-opening the gating, and I did not want to over-build v1; scoping it more tightly (for example only when send-buffer-limited) may be the right call and I would defer to your lab on it. Second, I have only exercised two subflows and no backup subflow so far. 3/3 adds two MPTcpExt counters (CwndPenalized, PenalCandidate) so a run can tell "the guard held the penalty back" from "the trigger never fired". Not for merge. I left your Co-developed-by on it in case it is useful to you elsewhere. I drove those regimes with a small simult_flows variant (receive-window- limited, send-buffer-limited, and autotuned cases). It is a helper, not selftest quality, so I did not fold it into the series; it is on a branch of my tree, in case it saves your lab time or you spot a case I missed: https://github.com/shardulsdk-mpiric/linux/blob/6926c4b7f583/tools/testing/selftests/net/mptcp/mptcp_sched_penalise.sh Run it on a baseline and a patched kernel and compare (prefix with MPTCP_LIB_IP_MPTCP=1 if pm_nl_ctl does not work in your setup): SCENARIO=suite ./mptcp_sched_penalise.sh SCENARIO=unbounded ./mptcp_sched_penalise.sh SCENARIO=rwnd RCVBUF=262144 ./mptcp_sched_penalise.sh SCENARIO=sndbuf SNDBUF=65536 ./mptcp_sched_penalise.sh SCENARIO=both RCVBUF=262144 SNDBUF=65536 ./mptcp_sched_penalise.sh For the rwnd/sndbuf/both scenarios the simult_flows pass/fail bound is not meaningful (it assumes both paths are fully used): read the printed runtime and out-of-order counts, not OK/FAIL. The "both" case also occasionally fails to bring up the second subflow with the very small SO_SNDBUF; just rerun it if you see a single-subflow run. Thanks, Shardul Signed-off-by: Shardul Bankar <[email protected]> --- Shardul Bankar (3): mptcp: sched: penalise a slow subflow by halving its cwnd mptcp: sched: do not penalise when receive-window-limited DO-NOT-MERGE: mptcp: sched: penalise counters net/mptcp/mib.c | 2 ++ net/mptcp/mib.h | 2 ++ net/mptcp/protocol.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++-- net/mptcp/protocol.h | 2 ++ 4 files changed, 97 insertions(+), 3 deletions(-) --- base-commit: 97ce11d2793f114ca652a565a8d2795c085d8ff1 change-id: 20260726-mptcp_penalise_send-2fbf15329c71 Best regards, -- Shardul Bankar <[email protected]>