From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796456826; b=vaJBuYg+ZRcPTVLcvuPmU77/UpNpGnfk+udvEDJo9MbHjiDf6llx7xhaosN2x2LpNI/5 BjjH8FU6ruKAkPESjPJ6HwJLSCd/CiUDIEcgyV3Cj4HSwimay2IroVBso2KW0lmn2JMJL pAjRUyLfIPolucnE8S0q9QAEfQODCCvIvS5ijqovwu4DkeyA75ywdI7s0orL2eOtYSirP 335mFmfoUQi8e5rgFIHG4JHoInP8bc+mz1blKxkxetcJvYcxTvngG8FEP1oynweH3rSAc Je5dYlPET7GMsrjrgEdeR6u1fYyqDO+0s03na15lig/gL70KqqC4tSM1QTew7Jz0s1w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796456826; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=WnS31OOXGLIfz2t+4WGbLZ1CxKJi2rZfhLRh9rz4V7I=; b=TadKR76qriCHmIOgxgns+d68f+xYC0WfH086eB0S0MyYcI5mQiWns8IhdL84s0E3HdMv IcPNeeWx+gc/MR7mnsAmynHwMQyhlfJCV/raud/RMyN2LMrM09zhfSk4t5dNNdz2vr8nf 7gdPqnSAS6WYaRBw0d7r9f3a07MDcAwAAb1beZ07sB/uyg6GWZigTbHGS+fq9hOQJIc5n Fd7ZGkF6FtQ+GYlVoQJmFvwMqPJVJrCLoPnCeqOkQJhWsOdk3Obwk+n7ppUq4ODKrZLuN m5j9/pVlK56eNT0dv9t5foHPwNcFh3YjvnJs7BDHNApJSRW1I7Rs3kNJyHhzHfEWctA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WYp936qq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14D67606A322 for ; Sat, 5 Dec 2026 07:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WYp936qq Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92E701F00936; Sat, 5 Dec 2026 07:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796456825; bh=WnS31OOXGLIfz2t+4WGbLZ1CxKJi2rZfhLRh9rz4V7I=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=WYp936qq8uaIzeUrs8OPHv6rmQDeFQceFauGiB/rmhTc9ZlPIOUuIxL799EANVMhC A3Me8vrsho1drvgWIfFocY+yUaGe3T5ruGjajOclsykZVa6321eqvAmS6djzfx/Q0r GkF0sXir299JV4CQYFQYojhSUvWwBUHrRKXhxVdbQgJVXtXRsVBkvnYJiy/9MaJJwW +Fw7aEAGSZiqi2/iubIUClmyLyqmSA0S4K4rL+kdAWSMEa7DiWT/hYUME+9YzGF4ua kOM18ArZUWAnKiJo2LsiGERTTGzkODx+XSoaTYA23YV6F3W+xmgjVc5PGyn1ap5zg6 VlgHPMzTPFl1w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH mptcp-next v12 1/4] mptcp: track app-limited state in mptcp_sendmsg Reply-To: sashiko-reviews@lists.linux.dev To: "Geliang Tang" , mptcp@lists.linux.dev In-Reply-To: <605d991d94090eda7a72b085b85cacfd76ec7c26.1796455402.git.tanggeliang@kylinos.cn> References: <605d991d94090eda7a72b085b85cacfd76ec7c26.1796455402.git.tanggeliang@kylinos.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 07:47:05 +0000 X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] mptcp: wait_for_memory in mptcp_sendmsg() drops app_limited before copy - [Medium] mptcp: unnecessary mptcp_data_lock() in mptcp_rate_check_app_limited() -- commit 36682c147f4e37f3adc6c7a4255afd1bde0e45ce Author: Geliang Tang mptcp: track app-limited state in mptcp_sendmsg This commit tracks application-limited state in mptcp_sendmsg() by checking MPTCP-level send conditions at entry and calling tcp_rate_check_app_limited() on drained subflows in mptcp_sendmsg_frag(). > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > index b9c6e5a615c8b..1c6dc621191f3 100644 > --- a/net/mptcp/protocol.c > +++ b/net/mptcp/protocol.c [ ... ] > @@ -2112,9 +2121,39 @@ static void mptcp_rps_record_subflows(const struct= mptcp_sock *msk) > } > } > =20 > +static bool mptcp_rate_check_app_limited(struct sock *sk) > +{ > + struct mptcp_sock *msk =3D mptcp_sk(sk); > + struct mptcp_subflow_context *subflow; > + bool app_limited; > + > + if (msk->write_seq !=3D msk->snd_nxt || mptcp_send_head(sk) || > + test_bit(MPTCP_WORK_RTX, &msk->flags)) > + return false; > + > + mptcp_data_lock(sk); > + app_limited =3D !test_bit(MPTCP_RETRANSMIT, &msk->cb_flags) && > + !(msk->recovery && > + before64(msk->snd_una, msk->recovery_snd_nxt)) && > + (__mptcp_check_fallback(msk) || > + after64(mptcp_wnd_end(msk), msk->snd_nxt)); > + mptcp_data_unlock(sk); > + if (!app_limited) > + return false; [Severity: Medium] Is mptcp_data_lock(sk) needed here on the mptcp_sendmsg() hot path? Acquiring sk->sk_lock.slock on every drained-queue sendmsg() doubles spinlock acquisitions per syscall on 64-bit, adds a BH disable/enable pair, and contends with softirq processing in ack_update_msk() and mptcp_data_ready(). Under lock_sock(sk), __mptcp_check_fallback(msk), mptcp_wnd_end(msk), msk->snd_nxt, msk->recovery, and msk->recovery_snd_nxt are already lockless or stable, and msk->snd_una is only checked when msk->recovery is set. Since mptcp_retransmit_timer() can set MPTCP_RETRANSMIT in msk->cb_flags right after unlock anyway, reading these fields locklessly would avoid the spinlock. [ ... ] > @@ -2223,7 +2266,8 @@ static int mptcp_sendmsg(struct sock *sk, struct ms= ghdr *msg, size_t len) > =20 > wait_for_memory: > sk_set_nospace(sk); > - __mptcp_push_pending(sk, msg->msg_flags); > + __mptcp_push_pending(sk, msg->msg_flags, app_limited); > + app_limited =3D false; > ret =3D sk_stream_wait_memory(sk, &timeo); > if (ret) > goto do_error; [Severity: Medium] Can clearing app_limited here drop the app-limited marking when wait_for_memory is reached before any data is copied? When unacked in-flight dfrags fill sk->sk_sndbuf while msk->write_seq =3D=3D msk->snd_nxt and mptcp_send_head(sk) =3D=3D NULL, mptcp_rate_check_app_limited() returns true, but mptcp_send_limit() returns 0 on the first iteration and jumps straight to wait_for_memory. __mptcp_push_pending() then returns without calling tcp_rate_check_app_limited(ssk), and app_limited =3D false discards the decision before sk_stream_wait_memory(). After wakeup, tp->app_limited stays unset, so BBR treats send-buffer-limited flights as network-limited. Clearing app_limited only when data was actually queued to push (or marking drained subflows before sleeping, as tcp_sendmsg_locked() does) would preserve the app-limited state across the wait. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796455402.gi= t.tanggeliang@kylinos.cn?part=3D1