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(-)
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 <shardul.b@mpiricsoftware.com>
---
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 <shardul.b@mpiricsoftware.com>
Hi Shardul, On 26/07/2026 07:55, Shardul Bankar wrote: > 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. Thank you for having sent these patches! Note for others: these were supposed to be offlist RFC patches, as an iteration for the development we started off list, but they were accidentally shared here. I think that's fine, sorry for the noise, but please consider this series as an RFC. I have some questions and small comments. > 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. Sounds good to me! > - 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. It feels to me that you require this because patch 1/3 doesn't check if the MPTCP connection was "send-buffer-limited", no? But you are doing something very similar, no? Without testing, it feels like this is required not to limit the penalisation to when it is really needed. > 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 Sounds good! Did you check with a fixed sndbuf higher than the rcv one? Also, be careful that with netem, the limits you give to run_test() can influence a lot the bufferbloat. Did you monitor the RTTs during these transfers? On the other hand, it would be good to validate this with one path having bufferbloat. These patches should also help to improve the situation. (And issue #332 should help even more) > 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. I see, yes. I think what is important here for #345, is that when the transfer is buffer limited, the slow subflow impact should be reduced. At least not to cause the transfer to be worse than without this slow subflow. Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Matt, On Wed, 2026-07-29 at 13:48 +0200, Matthieu Baerts wrote: > Hi Shardul, > > On 26/07/2026 07:55, Shardul Bankar wrote: > > > > > > - 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. > > It feels to me that you require this because patch 1/3 doesn't check > if > the MPTCP connection was "send-buffer-limited", no? But you are doing > something very similar, no? Without testing, it feels like this is > required not to limit the penalisation to when it is really needed. > Patch 1 does gate on load, with tcp_is_cwnd_limited(); though that is not the send-buffer-limited check. The send-buffer-limited check never fires at scheduler time in this tree, as the msk buffer has just drained into the subflows. Patch 2 guards the receive-window-limited case, where patch 1 without it can regress the transfer about 2x in my tests. I have kept it as the explicit guard and am still characterizing when patch 1 alone would suffice. Would you prefer we drop it? > > > > > > 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 > > Sounds good! Did you check with a fixed sndbuf higher than the rcv > one? > Yes (SNDBUF 256K, RCVBUF 128K). The guard correctly suppresses the penalty there: the receiver is genuinely at a zero window (receive- window-limited, not congestion-limited), and it is not slower than baseline. > Also, be careful that with netem, the limits you give to run_test() > can > influence a lot the bufferbloat. Did you monitor the RTTs during > these > transfers? > I do now. The harness samples the subflows' srtt, and it confirms your point: the netem queue length drives it (srtt max is about 40 ms with the fast path alone, rising to several seconds on a bufferbloated path). > On the other hand, it would be good to validate this with one path > having bufferbloat. These patches should also help to improve the > situation. (And issue #332 should help even more) > I added a bufferbloated-slow-path case, but it was too noisy to draw a firm conclusion: the completion times swung widely, and the same swing was on the baseline kernel, so my setup is not measuring the effect cleanly. I would build a more controlled bufferbloat case (a moderate, stable queue, and a latency metric rather than completion time). I agree #332 is likely the bigger lever there. > > 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. > > I see, yes. I think what is important here for #345, is that when the > transfer is buffer limited, the slow subflow impact should be > reduced. > At least not to cause the transfer to be worse than without this slow > subflow. > Using that as the bar: when send-buffer-limited, the penalised two-path transfer beats the fast path alone (about 11.3 s against 14.4 s), with roughly 15 to 20% less out-of-order data, so the slow subflow helps. When it is bufferbloated, it comes out about even with the fast path alone. I have all of these changes ready in my tree. I would rather settle whether patch 2 stays (above) and the counters question on 3/3 before I post v2, but I am glad to send v2 now if you would prefer to look at the code directly. Thanks, Shardul
Hi Shardul, Thank you for your reply! On 07/08/2026 17:17, Shardul Bankar wrote: > Hi Matt, > > On Wed, 2026-07-29 at 13:48 +0200, Matthieu Baerts wrote: >> Hi Shardul, >> >> On 26/07/2026 07:55, Shardul Bankar wrote: >>> >>> >>> - 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. >> >> It feels to me that you require this because patch 1/3 doesn't check >> if >> the MPTCP connection was "send-buffer-limited", no? But you are doing >> something very similar, no? Without testing, it feels like this is >> required not to limit the penalisation to when it is really needed. >> > > Patch 1 does gate on load, with tcp_is_cwnd_limited(); though that is > not the send-buffer-limited check. The send-buffer-limited check never > fires at scheduler time in this tree, as the msk buffer has just > drained into the subflows. Patch 2 guards the receive-window-limited > case, where patch 1 without it can regress the transfer about 2x in my > tests. I have kept it as the explicit guard and am still characterizing > when patch 1 alone would suffice. Would you prefer we drop it? Dropping it, no, but I was more thinking about squashing. But fine to keep it separated (but within the same series) for now or even for the final version if that helps with the explanations and reviews. >>> 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 >> >> Sounds good! Did you check with a fixed sndbuf higher than the rcv >> one? >> > > Yes (SNDBUF 256K, RCVBUF 128K). The guard correctly suppresses the > penalty there: the receiver is genuinely at a zero window (receive- > window-limited, not congestion-limited), and it is not slower than > baseline. Nice, thank you! >> Also, be careful that with netem, the limits you give to run_test() >> can >> influence a lot the bufferbloat. Did you monitor the RTTs during >> these >> transfers? >> > > I do now. The harness samples the subflows' srtt, and it confirms your > point: the netem queue length drives it (srtt max is about 40 ms with > the fast path alone, rising to several seconds on a bufferbloated > path). > >> On the other hand, it would be good to validate this with one path >> having bufferbloat. These patches should also help to improve the >> situation. (And issue #332 should help even more) >> > > I added a bufferbloated-slow-path case, but it was too noisy to draw a > firm conclusion: the completion times swung widely, and the same swing > was on the baseline kernel, so my setup is not measuring the effect > cleanly. I would build a more controlled bufferbloat case (a moderate, > stable queue, and a latency metric rather than completion time). I > agree #332 is likely the bigger lever there. Indeed, that's where my lab would be handy (but not ready yet, keep being delayed by "urgent fixes"...) >>> 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. >> >> I see, yes. I think what is important here for #345, is that when the >> transfer is buffer limited, the slow subflow impact should be >> reduced. >> At least not to cause the transfer to be worse than without this slow >> subflow. >> > > Using that as the bar: when send-buffer-limited, the penalised two-path > transfer beats the fast path alone (about 11.3 s against 14.4 s), with > roughly 15 to 20% less out-of-order data, so the slow subflow helps. > When it is bufferbloated, it comes out about even with the fast path > alone. Excellent! > I have all of these changes ready in my tree. I would rather settle > whether patch 2 stays (above) and the counters question on 3/3 before I > post v2, but I am glad to send v2 now if you would prefer to look at > the code directly. See my other replies, but in short: - patch 2 can stay or not, up to you - extending the tracing and keeping the counters (at least "Penalized") Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Shardul,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/30190751415
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/ccb68814458b
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1134545
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
© 2016 - 2026 Red Hat, Inc.