From: Geliang Tang <geliang@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net 2/3] mptcp: factor-out cgroup data inherit helper
Date: Tue, 11 Nov 2025 15:24:57 +0800 [thread overview]
Message-ID: <e9a05dbbd8030cd12d280b19d9f5fe119926323c.camel@kernel.org> (raw)
In-Reply-To: <60403f2c512fa05217c72b2d0d840bad3f60d402.1762551942.git.pabeni@redhat.com>
Hi Paolo,
On Fri, 2025-11-07 at 22:55 +0100, Paolo Abeni wrote:
> MPTCP will soon need the same functionality for passive sockets,
> factor them out in a common helper. No functional change intended.
>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This patch looks good to me.
Reviewed-by: Geliang Tang <geliang@kernel.org>
Thanks,
-Geliang
> ---
> net/mptcp/protocol.h | 2 ++
> net/mptcp/subflow.c | 20 ++++++++++++--------
> 2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 051f21b06d33..300ac7030958 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -755,6 +755,8 @@ mptcp_subflow_delegated_next(struct
> mptcp_delegated_action *delegated)
> return ret;
> }
>
> +void __mptcp_inherit_cgrp_data(struct sock *sk, struct sock *ssk);
> +
> int mptcp_is_enabled(const struct net *net);
> unsigned int mptcp_get_add_addr_timeout(const struct net *net);
> int mptcp_is_checksum_enabled(const struct net *net);
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 60f100b2a0c9..599a21d92590 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -1721,21 +1721,25 @@ int __mptcp_subflow_connect(struct sock *sk,
> const struct mptcp_pm_local *local,
> return err;
> }
>
> -static void mptcp_attach_cgroup(struct sock *parent, struct sock
> *child)
> +void __mptcp_inherit_cgrp_data(struct sock *sk, struct sock *ssk)
> {
> #ifdef CONFIG_SOCK_CGROUP_DATA
> - struct sock_cgroup_data *parent_skcd = &parent-
> >sk_cgrp_data,
> - *child_skcd = &child->sk_cgrp_data;
> + struct sock_cgroup_data *sk_cd = &sk->sk_cgrp_data,
> + *ssk_cd = &ssk->sk_cgrp_data;
>
> /* only the additional subflows created by kworkers have to
> be modified */
> - if (cgroup_id(sock_cgroup_ptr(parent_skcd)) !=
> - cgroup_id(sock_cgroup_ptr(child_skcd))) {
> - cgroup_sk_free(child_skcd);
> - *child_skcd = *parent_skcd;
> - cgroup_sk_clone(child_skcd);
> + if (cgroup_id(sock_cgroup_ptr(sk_cd)) !=
> + cgroup_id(sock_cgroup_ptr(ssk_cd))) {
> + cgroup_sk_free(ssk_cd);
> + *ssk_cd = *sk_cd;
> + cgroup_sk_clone(sk_cd);
> }
> #endif /* CONFIG_SOCK_CGROUP_DATA */
> +}
>
> +static void mptcp_attach_cgroup(struct sock *parent, struct sock
> *child)
> +{
> + __mptcp_inherit_cgrp_data(parent, child);
> if (mem_cgroup_sockets_enabled)
> mem_cgroup_sk_inherit(parent, child);
> }
next prev parent reply other threads:[~2025-11-11 7:24 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 [this message]
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
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=e9a05dbbd8030cd12d280b19d9f5fe119926323c.camel@kernel.org \
--to=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