MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net 3/3] mptcp: fix memcg accounting for passive sockets
Date: Tue, 11 Nov 2025 18:25:07 +0100	[thread overview]
Message-ID: <61dce5d9-0dac-4c42-af9f-231b537844c4@kernel.org> (raw)
In-Reply-To: <7d43f35c26a94f22a8e7627f477560ba994efbe7.camel@kernel.org>

Hi Geliang,

On 11/11/2025 09:37, Geliang Tang wrote:
> Hi Paolo,
> 
> Thanks for this fix.
> 
> On Fri, 2025-11-07 at 22:55 +0100, Paolo Abeni wrote:
>> The passive sockets never got proper memcg accounting: the msk
>> socket is associated with the memcg at accept time, but the
>> passive subflows never got it right.
>>
>> At accept time, traverse the subflows list and associate each of them
>> with the msk memcg, and try to do the same at join completion time,
>> if
>> the msk has been already accepted.
>>
>> Fixes: cf7da0d66cc1 ("mptcp: Create SUBFLOW socket for incoming
>> connections")
>> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/298
>> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/597
>> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
>> ---
>>  net/mptcp/protocol.c | 36 ++++++++++++++++++++++++++----------
>>  net/mptcp/protocol.h |  1 +
>>  net/mptcp/subflow.c  | 10 ++++++++++
>>  3 files changed, 37 insertions(+), 10 deletions(-)
>>
>> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
>> index 34e6bc731085..5e9325c7ea9c 100644
>> --- a/net/mptcp/protocol.c
>> +++ b/net/mptcp/protocol.c
>> @@ -959,6 +959,8 @@ static bool __mptcp_finish_join(struct mptcp_sock
>> *msk, struct sock *ssk)
>>  	mptcp_subflow_ctx(ssk)->subflow_id = msk->subflow_id++;
>>  	mptcp_sockopt_sync_locked(msk, ssk);
>>  	mptcp_stop_tout_timer(sk);
>> +	__mptcp_inherit_cgrp_data(sk, ssk);
>> +	__mptcp_inherit_memcg(sk, ssk, GFP_ATOMIC);
> 
> In mptcp_graph_subflows(), these two lines already have the
> mem_cgroup_from_sk() check (in the squash-to patch). It's unclear
> whether mem_cgroup_from_sk() check needs to be added here too.

From what I understood, no need to check mem_cgroup_from_sk() here:

- __mptcp_inherit_cgrp_data() should not depend on that (I think)
- __mptcp_inherit_memcg() is doing that via mem_cgroup_sockets_enabled()

I *think* the squash-to patch needs some small further modifications,
but this series looks good to me.

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


  reply	other threads:[~2025-11-11 17:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 21:55 [PATCH mptcp-net 0/3] mptcp: fix memcg accounting for passive sockets Paolo Abeni
2025-11-07 21:55 ` [PATCH mptcp-net 1/3] net: factor-out _sk_charge() helper Paolo Abeni
2025-11-11  7:24   ` Geliang Tang
2025-11-11 17:38   ` Matthieu Baerts
2025-11-12  9:04     ` Paolo Abeni
2025-11-12  9:16       ` Matthieu Baerts
2025-11-12  9:28         ` Paolo Abeni
2025-11-12  9:55           ` Matthieu Baerts
2025-11-07 21:55 ` [PATCH mptcp-net 2/3] mptcp: factor-out cgroup data inherit helper Paolo Abeni
2025-11-11  7:24   ` Geliang Tang
2025-11-07 21:55 ` [PATCH mptcp-net 3/3] mptcp: fix memcg accounting for passive sockets Paolo Abeni
2025-11-11  8:37   ` Geliang Tang
2025-11-11 17:25     ` Matthieu Baerts [this message]
2025-11-12  9:10       ` Paolo Abeni
2025-11-08 15:15 ` [PATCH mptcp-net 0/3] " MPTCP CI
2025-11-11 17:26 ` Matthieu Baerts
2025-11-12  9:35   ` Paolo Abeni
2025-11-12  9:58     ` Matthieu Baerts
2025-11-12 10:10 ` Matthieu Baerts

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=61dce5d9-0dac-4c42-af9f-231b537844c4@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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