Skip to contentSkip to conversation

mptcp: check app-limited status on subflow sends

PATCH In review Lin Lei 5 participants 7 messages Dec 4

Subsystems (2)
lore
Share & tools
lore

Lin Lei

author
#0 lore raw

PATCH 1/1 mptcp: check app-limited status on subflow sends

mptcp_sendmsg_frag() appends payload directly to TCP subflow skbs, bypassing the tcp_rate_check_app_limited() call in tcp_sendmsg_locked(). Once the initial tp->app_limited (~0U) mark from tcp_init_sock() clears after the first acknowledged data segment, a subflow that runs out of data to send can produce unmarked delivery-rate samples (rs->is_app_limited == false) on subsequent writes.

Unmarked samples from underfilled flights can overwrite the saved TCP_INFO delivery rate (clearing tcpi_delivery_rate_app_limited), count toward BBR's full-bandwidth test in STARTUP, or pull down BBR's windowed max-bandwidth filter. Commit 6d0060f600ad ("mptcp: Write MPTCP DSS headers to outgoing data packets") introduced this omission when switching mptcp_sendmsg() from sock_sendmsg() on the subflow to mptcp_sendmsg_frag() and do_tcp_sendpages(), below tcp_sendmsg_locked() and tcp_sendpage_locked().

Call tcp_rate_check_app_limited(ssk) in mptcp_sendmsg_frag() once payload bytes are scheduled and before appending payload to the subflow skb and advancing tp->write_seq. This covers tail-skb appends, newly allocated skbs, zero-window probes, and data reinjected onto a subflow, while skipping early no-op or error returns.

We hit this while testing MPTCP with BBR under periodic small writes: on a 100 Mbit/s, 4 ms RTT veth link, 25 writes of 200 bytes spaced 20 ms apart after a 2 MiB transfer reduced the subflow's BBR bandwidth estimate from ~96 Mbit/s to ~2.7 Mbit/s. With this check, the subflow marks sparse sends app-limited and retains the ~96 Mbit/s estimate, matching plain TCP.

Fixes 6d0060f600ad ("mptcp: Write MPTCP DSS headers to outgoing data packets")
---
 net/mptcp/protocol.c | 2 ++
 1 file changed, 2 insertions(+)
net/mptcp/protocol.c +2 -0
index 550e7aed42a8..f3950d55c3b3 100644
@@ -1536,6 +1536,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 	}
 	copy = avail;
 
+	tcp_rate_check_app_limited(ssk);
+
 	if (can_coalesce) {
 		skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy);
 	} else {

base-commit: 9442ea6c3dc61f5d85d5062eb31a5437c260eba6

Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] mptcp: mptcp_sendmsg_frag() falsely marks rwnd-limited sends app-limited --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] mptcp: mptcp_sendmsg_frag() falsely marks rwnd-limited sends app-limited
--

commit 3acd5a37eb2a86bad7ee6c03d87d8982b48df0ea
Author: Lin Lei <[email protected]>

mptcp: check app-limited status on subflow sends

This commit adds a tcp_rate_check_app_limited() call in mptcp_sendmsg_frag() before appending payload to a subflow skb so that sparse MPTCP writes mark the subflow as application-limited.

net/mptcp/protocol.c static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, · line 1539

Quoted 9 lines
net/mptcp/protocol.c +1 -0
index 550e7aed42a86..f3950d55c3b3d 100644
@@ -1536,6 +1536,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 	}
 	copy = avail;
 
+	tcp_rate_check_app_limited(ssk);

[Severity: Medium]
Can calling tcp_rate_check_app_limited() unconditionally here falsely mark receive-window-limited bulk transfers as app-limited?

Unlike plain TCP, MPTCP buffers unsent bulk data in msk->rtx_queue and clamps subflow enqueueing to msk->wnd_end in mptcp_check_allowed_size(). When rwnd < cwnd, the subflow write queue drains to tp->write_seq == tp->snd_nxt even though unsent data remains in msk->rtx_queue.

When an ACK advances msk->wnd_end, ack_update_msk() -> __mptcp_check_push() pushes queued data into mptcp_sendmsg_frag(). Because the subflow write queue is empty and tcp_packets_in_flight(tp) < tcp_snd_cwnd(tp), tcp_rate_check_app_limited(ssk) re-arms tp->app_limited on every ACK.

Under BBR, those false rs->is_app_limited samples prevent bbr_check_full_bw_reached() from exiting BBR_STARTUP and prevent bbr_update_bw() from lowering the max bandwidth filter when link capacity drops.

Should this check account for unsent data queued in msk->rtx_queue before marking the subflow app-limited?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Lin Lei

Hi Lin,

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! ✅
- Perf: Unstable: regression:sched-baseline regression:sched-bbr regression:sched-rmem(4) regression:sched-serverlim validation:sched-loss ⚠️ (4 improvements, 69 new outliers to review)
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/47251881048

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/8a19b6ae60ea
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1231305

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)

#3 lore raw
In reply to Lin Lei
Quoted 30 lines · Lin Lei

mptcp_sendmsg_frag() appends payload directly to TCP subflow skbs, bypassing the tcp_rate_check_app_limited() call in tcp_sendmsg_locked(). Once the initial tp->app_limited (~0U) mark from tcp_init_sock() clears after the first acknowledged data segment, a subflow that runs out of data to send can produce unmarked delivery-rate samples (rs->is_app_limited == false) on subsequent writes.

Unmarked samples from underfilled flights can overwrite the saved TCP_INFO delivery rate (clearing tcpi_delivery_rate_app_limited), count toward BBR's full-bandwidth test in STARTUP, or pull down BBR's windowed max-bandwidth filter. Commit 6d0060f600ad ("mptcp: Write MPTCP DSS headers to outgoing data packets") introduced this omission when switching mptcp_sendmsg() from sock_sendmsg() on the subflow to mptcp_sendmsg_frag() and do_tcp_sendpages(), below tcp_sendmsg_locked() and tcp_sendpage_locked().

Call tcp_rate_check_app_limited(ssk) in mptcp_sendmsg_frag() once payload bytes are scheduled and before appending payload to the subflow skb and advancing tp->write_seq. This covers tail-skb appends, newly allocated skbs, zero-window probes, and data reinjected onto a subflow, while skipping early no-op or error returns.

We hit this while testing MPTCP with BBR under periodic small writes: on a 100 Mbit/s, 4 ms RTT veth link, 25 writes of 200 bytes spaced 20 ms apart after a 2 MiB transfer reduced the subflow's BBR bandwidth estimate from ~96 Mbit/s to ~2.7 Mbit/s. With this check, the subflow marks sparse sends app-limited and retains the ~96 Mbit/s estimate, matching plain TCP.

Quoted 6 lines
Fixes 6d0060f600ad ("mptcp: Write MPTCP DSS headers to outgoing data packets")
---
 net/mptcp/protocol.c | 2 ++
 1 file changed, 2 insertions(+)

Hi Lin,

Thanks for the patch.

It seems to address the same issue like a recent patch from Geliang [1]. Right?

If so, could you plase test your scenario based on Geliang's patch, share your
test results on that thread, and add your Tested-by tag if it works for you. If not, please feel free to leave a message here, and sorry for the noise!

[1] https://lore.kernel.org/mptcp/4fc318fc6b3764ff8ff0547f7a9d69ff707fa3b1.1796308130.git.geliang@kernel.org/

Best regards,
Gang

Quoted 18 lines
net/mptcp/protocol.c +2 -0
index 550e7aed42a8..f3950d55c3b3 100644
@@ -1536,6 +1536,8 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
 }
 copy = avail;
 
+ tcp_rate_check_app_limited(ssk);
+
 if (can_coalesce) {
 skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy);
 } else {

base-commit: 9442ea6c3dc61f5d85d5062eb31a5437c260eba6

Signature · 1 line
2.43.0
author
#4 lore raw

Hi Gang,

Quoted 4 lines · On Fri, 04 Dec 2026 09:08:29 +0000, [email protected] wrote:

It seems to address the same issue like a recent patch from Geliang [1]. Right?

If so, could you plase test your scenario based on Geliang's patch, share your test results on that thread, and add your Tested-by tag if it works for you.

Yes, it is the same issue, sorry I missed Geliang's patch!

I tested Geliang's patch [1] with our MPTCP + BBR scenario (as well as the rwnd-limited bulk case Sashiko pointed out on mine) and it works well. Please mark my patch as Superseded.

[1] https://lore.kernel.org/mptcp/4fc318fc6b3764ff8ff0547f7a9d69ff707fa3b1.1796308130.git.geliang@kernel.org/

Thanks,
Lin

maintainer
#5 lore raw

Hi Lin, Gang, Geliang,

Quoted 5 lines · Lin Lei

Hi Gang,

Quoted 2 lines · On Fri, 04 Dec 2026 09:08:29 +0000, [email protected] wrote:

It seems to address the same issue like a recent patch from Geliang [1]. Right?

Quoted 8 lines
Quoted 2 lines

If so, could you plase test your scenario based on Geliang's patch, share your test results on that thread, and add your Tested-by tag if it works for you.

Yes, it is the same issue, sorry I missed Geliang's patch!

I tested Geliang's patch [1] with our MPTCP + BBR scenario (as well as the rwnd-limited bulk case Sashiko pointed out on mine) and it works well.

Sashiko also has a few comments about that one.

Note: I'm working on a series that improves the performances (but it is on top of a huge pile of fixes, so we might need to be patient). To avoid working on conflicting areas, we might need to sync. I could eventually share my WIP work on a branch somewhere once I manage to send the current fixes patches I have.

Quoted 1 line

Please mark my patch as Superseded.

Done.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#6 lore raw

Hi Lin, Gang, Geliang,

Quoted 11 lines · Matthieu Baerts

Hi Lin, Gang, Geliang,

Quoted 8 lines · Lin Lei

Hi Gang,

Quoted 4 lines · On Fri, 04 Dec 2026 09:08:29 +0000, [email protected] wrote:

It seems to address the same issue like a recent patch from Geliang [1]. Right?

If so, could you plase test your scenario based on Geliang's patch, share your test results on that thread, and add your Tested-by tag if it works for you.

Quoted 7 lines
Quoted 5 lines

Yes, it is the same issue, sorry I missed Geliang's patch!

I tested Geliang's patch [1] with our MPTCP + BBR scenario (as well as the rwnd-limited bulk case Sashiko pointed out on mine) and it works well.

Sashiko also has a few comments about that one.

I will try to address them in a new version in my huge fixes' series.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.