All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
@ 2026-12-04  2:06 Lin Lei
  2026-12-04  2:24 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Lin Lei @ 2026-12-04  2:06 UTC (permalink / raw)
  To: MPTCP Linux

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")
Signed-off-by: Lin Lei <llleigoing@gmail.com>
---
 net/mptcp/protocol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 550e7aed42a8..f3950d55c3b3 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -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
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
  2026-12-04  2:06 [PATCH mptcp-net] mptcp: check app-limited status on subflow sends Lin Lei
@ 2026-12-04  2:24 ` sashiko-bot
  2026-12-04  3:27 ` MPTCP CI
  2026-12-04  9:08 ` gang.yan
  2 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-04  2:24 UTC (permalink / raw)
  To: Lin Lei, MPTCP Linux

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 <llleigoing@gmail.com>

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.

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 550e7aed42a86..f3950d55c3b3d 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -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?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204020611.3657002-1-llleigoing@gmail.com?part=1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
  2026-12-04  2:06 [PATCH mptcp-net] mptcp: check app-limited status on subflow sends Lin Lei
  2026-12-04  2:24 ` sashiko-bot
@ 2026-12-04  3:27 ` MPTCP CI
  2026-12-04  9:08 ` gang.yan
  2 siblings, 0 replies; 7+ messages in thread
From: MPTCP CI @ 2026-12-04  3:27 UTC (permalink / raw)
  To: Lin Lei; +Cc: mptcp

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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
  2026-12-04  2:06 [PATCH mptcp-net] mptcp: check app-limited status on subflow sends Lin Lei
  2026-12-04  2:24 ` sashiko-bot
  2026-12-04  3:27 ` MPTCP CI
@ 2026-12-04  9:08 ` gang.yan
  2026-12-04 10:43   ` Lin Lei
  2 siblings, 1 reply; 7+ messages in thread
From: gang.yan @ 2026-12-04  9:08 UTC (permalink / raw)
  To: Lin Lei, MPTCP Linux

December 4, 2026 at 10:06 AM, "Lin Lei" <llleigoing@gmail.com mailto:llleigoing@gmail.com?to=%22Lin%20Lei%22%20%3Cllleigoing%40gmail.com%3E > wrote:


> 
> 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")
> Signed-off-by: Lin Lei <llleigoing@gmail.com>
> ---
>  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

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 550e7aed42a8..f3950d55c3b3 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -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
> -- 
> 2.43.0
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
  2026-12-04  9:08 ` gang.yan
@ 2026-12-04 10:43   ` Lin Lei
  2026-12-04 11:12     ` Matthieu Baerts
  0 siblings, 1 reply; 7+ messages in thread
From: Lin Lei @ 2026-12-04 10:43 UTC (permalink / raw)
  To: gang.yan; +Cc: Geliang Tang, MPTCP Linux, sashiko-reviews

Hi Gang,

On Fri, 04 Dec 2026 09:08:29 +0000, gang.yan@linux.dev 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
  2026-12-04 10:43   ` Lin Lei
@ 2026-12-04 11:12     ` Matthieu Baerts
  2026-12-04 17:55       ` Matthieu Baerts
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Baerts @ 2026-12-04 11:12 UTC (permalink / raw)
  To: Lin Lei; +Cc: gang.yan, Geliang Tang, MPTCP Linux, sashiko-reviews

Hi Lin, Gang, Geliang,

On 04/12/2026 11:43, Lin Lei wrote:
> Hi Gang,
> 
> On Fri, 04 Dec 2026 09:08:29 +0000, gang.yan@linux.dev 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.

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.

> Please mark my patch as Superseded.

Done.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH mptcp-net] mptcp: check app-limited status on subflow sends
  2026-12-04 11:12     ` Matthieu Baerts
@ 2026-12-04 17:55       ` Matthieu Baerts
  0 siblings, 0 replies; 7+ messages in thread
From: Matthieu Baerts @ 2026-12-04 17:55 UTC (permalink / raw)
  To: Lin Lei; +Cc: gang.yan, Geliang Tang, MPTCP Linux, sashiko-reviews

Hi Lin, Gang, Geliang,

On 04/12/2026 12:12, Matthieu Baerts wrote:
> Hi Lin, Gang, Geliang,
> 
> On 04/12/2026 11:43, Lin Lei wrote:
>> Hi Gang,
>>
>> On Fri, 04 Dec 2026 09:08:29 +0000, gang.yan@linux.dev 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.
> 
> 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
-- 
Sponsored by the NGI0 Core fund.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-04 17:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  2:06 [PATCH mptcp-net] mptcp: check app-limited status on subflow sends Lin Lei
2026-12-04  2:24 ` sashiko-bot
2026-12-04  3:27 ` MPTCP CI
2026-12-04  9:08 ` gang.yan
2026-12-04 10:43   ` Lin Lei
2026-12-04 11:12     ` Matthieu Baerts
2026-12-04 17:55       ` Matthieu Baerts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.