From: sashiko-bot@kernel.org
To: "Cai Xinchen" <caixinchen1@huawei.com>
Cc: tj@kernel.org, mkoutny@suse.com, mptcp@lists.linux.dev,
hannes@cmpxchg.org
Subject: Re: [PATCH RFC -next 3/5] mptcp: sync memcg budget and drop backlog page compensation
Date: Thu, 24 Sep 2026 07:51:28 +0000 [thread overview]
Message-ID: <20260924075128.778481F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260924080219.1036588-4-caixinchen1@huawei.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mptcp: memcg accounting bypass when propagating SO_SNDBUF to subflows
--
commit 81a89371b8c44bb27224e5c7531703509f0431a0
Author: Cai Xinchen <caixinchen1@huawei.com>
mptcp: sync memcg budget and drop backlog page compensation
This commit syncs the memcg budget tracker at MPTCP budget writes and
refunds budgets when subflows move to the msk's memcg. By charging budgets
upfront, it removes the per-page compensation mechanism for unaccounted
backlogs to prevent double-charging.
[ ... ]
> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index fcf6feb2a9eb5..05d9dafa8c071 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c
> @@ -70,6 +70,7 @@ static int mptcp_get_int_option(struct mptcp_sock *msk, sockptr_t optval,
> static void __mptcp_subflow_set_rcvbuf(struct sock *ssk, int val)
> {
> WRITE_ONCE(ssk->sk_rcvbuf, val);
> + sk_memcg_budget_sync(ssk, gfp_memcg_charge());
> tcp_set_rcvbuf(ssk, val);
> }
[Severity: High]
This patch introduces upfront memcg charging and correctly syncs the budget
for SO_RCVBUF updates via __mptcp_subflow_set_rcvbuf(), but is it also
necessary to sync the budget for SO_SNDBUF updates?
When SO_SNDBUF is propagated to subflows, the socket buffer limits are
updated but the memcg budget is not synced. For example, in
mptcp_sol_socket_sync_intval():
case SO_SNDBUF:
case SO_SNDBUFFORCE:
ssk->sk_userlocks |= SOCK_SNDBUF_LOCK;
WRITE_ONCE(ssk->sk_sndbuf, sk->sk_sndbuf);
mptcp_subflow_ctx(ssk)->cached_sndbuf = sk->sk_sndbuf;
break;
And similarly in sync_socket_options() when newly joined subflows inherit
the options:
if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) {
WRITE_ONCE(ssk->sk_sndbuf, sk->sk_sndbuf);
mptcp_subflow_ctx(ssk)->cached_sndbuf = sk->sk_sndbuf;
}
Could this bypass memcg accounting for MPTCP subflows, allowing TCP socket
buffers to grow up to the new limits without the cgroup being charged?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260924080219.1036588-1-caixinchen1@huawei.com?part=3
next prev parent reply other threads:[~2026-09-24 7:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 8:02 [PATCH RFC -next 0/5] net: charge socket memory budget to memcg upfront Cai Xinchen
2026-09-24 8:02 ` [PATCH RFC -next 1/5] " Cai Xinchen
2026-09-24 7:53 ` sashiko-bot
2026-09-24 8:02 ` [PATCH RFC -next 2/5] tcp: sync memcg budget on protocol buffer updates Cai Xinchen
2026-09-24 7:51 ` sashiko-bot
2026-09-24 8:02 ` [PATCH RFC -next 3/5] mptcp: sync memcg budget and drop backlog page compensation Cai Xinchen
2026-09-24 7:51 ` sashiko-bot [this message]
2026-09-24 8:02 ` [PATCH RFC -next 4/5] Docs/admin-guide/cgroup-v2: document upfront socket budget charging Cai Xinchen
2026-09-24 8:02 ` [PATCH RFC -next 5/5] selftests/cgroup: compare socket memory deltas in test_memcg_sock Cai Xinchen
2026-09-24 8:26 ` [PATCH RFC -next 0/5] net: charge socket memory budget to memcg upfront Eric Dumazet
2026-09-24 9:25 ` Cai Xinchen
2026-09-24 9:28 ` Cai Xinchen
2026-09-24 9:55 ` Eric Dumazet
2026-09-24 8:51 ` 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=20260924075128.778481F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=caixinchen1@huawei.com \
--cc=hannes@cmpxchg.org \
--cc=mkoutny@suse.com \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tj@kernel.org \
/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