MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v9 1/4] mptcp: track app-limited state in mptcp_sendmsg
Date: Thu, 03 Dec 2026 04:02:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-247139@kernel.org> (raw)
In-Reply-To: <c3e60721e7f0792f7860d3a8eca19803bbc1a50c.1796269554.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mptcp: stale msk->app_limited across pushes in
  __subflow_push_pending()
--

commit 78a7bf230ea83e645dd5621be256b86ac1607b21
Author: Geliang Tang <geliang@kernel.org>

mptcp: track app-limited state in mptcp_sendmsg

This commit checks whether the MPTCP send queue is empty at the start of
mptcp_sendmsg(), records that state in msk->app_limited, and calls
tcp_rate_check_app_limited() on scheduled subflows in
__subflow_push_pending().

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index b9c6e5a615c8b..56ecb38652d9b 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1815,6 +1815,9 @@ static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
>  	struct mptcp_data_frag *dfrag;
>  	int len, copied = 0, err = 0;
>  
> +	if (msk->app_limited)
> +		tcp_rate_check_app_limited(ssk);
> +
>  	while ((dfrag = mptcp_send_head(sk))) {
>  		info->sent = dfrag->already_sent;
>  		info->limit = dfrag->data_len;
> @@ -2112,6 +2115,20 @@ static void mptcp_rps_record_subflows(const struct mptcp_sock *msk)
>  	}
>  }
>  
> +static void mptcp_rate_check_app_limited(struct sock *sk)
> +{
> +	struct mptcp_sock *msk = mptcp_sk(sk);
> +	unsigned long flags, cb_flags;
> +
> +	flags = READ_ONCE(msk->flags);
> +	cb_flags = READ_ONCE(msk->cb_flags);
> +
> +	msk->app_limited = msk->write_seq == msk->snd_nxt &&
> +			   !mptcp_send_head(sk) &&
> +			   !test_bit(MPTCP_WORK_RTX, &flags) &&
> +			   !test_bit(MPTCP_RETRANSMIT, &cb_flags);
> +}
> +
>  static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
>  {
>  	struct mptcp_sock *msk = mptcp_sk(sk);
> @@ -2142,6 +2159,9 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
>  
>  	timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
>  
> +	/* is sending application-limited? */
> +	mptcp_rate_check_app_limited(sk);

[Severity: Medium]
Does msk->app_limited stay set across subsequent pushes after an initial
send on an idle socket?

mptcp_rate_check_app_limited() updates msk->app_limited only at the entry
of mptcp_sendmsg(), and nothing clears it once data is queued in
msk->rtx_queue and pushed.  When a large mptcp_sendmsg() starts on an idle
socket, msk->app_limited is set to 1 and remains 1 across wait_for_memory
pushes and asynchronous ACK or NAPI pushes (__mptcp_check_push() ->
__mptcp_subflow_push_pending() -> __subflow_push_pending()) while unsent
dfrags are still waiting in msk->rtx_queue.

Because MPTCP spools dfrags into each subflow in bursts, an incoming ACK
that drains a subflow's previous burst leaves that subflow with no queued
write data right before __subflow_push_pending() copies the next dfrag.
Seeing the stale msk->app_limited, tcp_rate_check_app_limited(ssk) marks
tp->app_limited during bulk transfers, causing rate-based congestion
controllers such as BBR to treat non-app-limited delivery samples as
application-limited.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796269554.git.tanggeliang@kylinos.cn?part=1

  reply	other threads:[~2026-12-03  4:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  3:50 [PATCH mptcp-next v9 0/4] prepare interfaces for kTLS and sockmap support Geliang Tang
2026-12-03  3:50 ` [PATCH mptcp-next v9 1/4] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-12-03  4:02   ` sashiko-bot [this message]
2026-12-03  3:50 ` [PATCH mptcp-next v9 2/4] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-12-03  3:50 ` [PATCH mptcp-next v9 3/4] mptcp: add sendmsg_locked to proto_ops Geliang Tang
2026-12-03  3:50 ` [PATCH mptcp-next v9 4/4] mptcp: update mptcp_check_readable Geliang Tang
2026-12-03  4:58 ` [PATCH mptcp-next v9 0/4] prepare interfaces for kTLS and sockmap support MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-247139@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox