Kuniyuki Iwashima
68889dfd54
mptcp: Fix up subflow's memcg when CONFIG_SOCK_CGROUP_DATA=n.
...
When sk_alloc() allocates a socket, mem_cgroup_sk_alloc() sets
sk->sk_memcg based on the current task.
MPTCP subflow socket creation is triggered from userspace or
an in-kernel worker.
In the latter case, sk->sk_memcg is not what we want. So, we fix
it up from the parent socket's sk->sk_memcg in mptcp_attach_cgroup().
Although the code is placed under #ifdef CONFIG_MEMCG, it is buried
under #ifdef CONFIG_SOCK_CGROUP_DATA.
The two configs are orthogonal. If CONFIG_MEMCG is enabled without
CONFIG_SOCK_CGROUP_DATA, the subflow's memory usage is not charged
correctly.
Let's move the code out of the wrong ifdef guard.
Note that sk->sk_memcg is freed in sk_prot_free() and the parent
sk holds the refcnt of memcg->css here, so we don't need to use
css_tryget().
Fixes: 3764b0c565 ("mptcp: attach subflow socket to parent cgroup")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com >
Reviewed-by: Eric Dumazet <edumazet@google.com >
Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org >
Acked-by: Shakeel Butt <shakeel.butt@linux.dev >
Link: https://patch.msgid.link/20250815201712.1745332-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org >
2025-08-19 19:20:58 -07:00
..
2025-08-05 16:02:07 +03:00
2025-08-05 13:28:46 -07:00
2025-07-23 11:55:22 +02:00
2025-06-05 22:02:25 -07:00
2025-04-05 10:30:12 +02:00
2025-07-13 16:38:29 -07:00
2025-03-16 22:06:27 -07:00
2025-07-24 19:12:36 -07:00
2025-03-16 22:06:24 -07:00
2025-07-24 19:12:36 -07:00
2025-05-22 14:55:36 -07:00
2025-07-13 16:38:30 -07:00
2025-05-12 23:50:38 -07:00
2025-07-13 16:38:21 -07:00
2025-07-24 19:12:35 -07:00
2024-07-03 19:29:58 -07:00
2025-07-01 13:25:36 -06:00
2025-01-13 22:40:59 -08:00
2025-08-02 12:06:13 -07:00
2024-11-03 01:28:06 -05:00
2024-09-01 20:43:33 -07:00
2024-09-01 20:43:33 -07:00
2025-07-31 14:57:54 -07:00
2025-03-04 17:02:25 +00:00
2025-07-13 16:38:31 -07:00
2024-07-03 19:30:06 -07:00
2025-07-19 18:59:53 -07:00
2025-07-24 19:12:39 -07:00
2025-03-17 00:05:35 -07:00
2025-05-12 23:50:35 -07:00
2025-03-16 22:06:31 -07:00
2025-07-09 22:42:05 -07:00
2025-03-16 22:06:29 -07:00
2025-07-19 18:59:57 -07:00
2024-07-03 19:29:58 -07:00
2025-03-16 22:06:20 -07:00
2025-08-05 16:02:07 +03:00
2025-03-16 22:06:23 -07:00
2025-08-02 12:06:10 -07:00
2025-03-17 00:05:32 -07:00
2025-08-05 13:28:47 -07:00
2025-08-05 13:28:47 -07:00
2025-07-31 14:57:54 -07:00
2025-07-09 22:41:56 -07:00
2025-07-09 22:42:22 -07:00
2025-08-02 12:06:09 -07:00
2025-08-02 12:06:10 -07:00
2025-07-09 22:42:17 -07:00
2025-05-12 23:50:42 -07:00
2025-05-22 14:55:38 -07:00
2025-03-21 22:03:11 -07:00
2025-08-19 19:20:58 -07:00
2025-07-19 18:59:57 -07:00
2025-07-13 16:38:29 -07:00
2025-08-05 16:02:07 +03:00
2025-07-13 16:38:15 -07:00
2025-07-31 14:57:54 -07:00
2025-07-19 18:59:45 -07:00
2025-08-02 12:06:13 -07:00
2025-07-13 16:38:17 -07:00
2024-03-13 12:12:21 -07:00
2025-07-09 22:42:17 -07:00
2025-07-19 18:59:57 -07:00
2025-08-02 12:06:10 -07:00
2025-07-19 18:59:45 -07:00
2025-07-13 16:38:17 -07:00
2025-08-02 12:06:11 -07:00
2025-07-31 14:57:54 -07:00
2025-05-31 22:46:12 -07:00
2025-05-12 23:50:31 -07:00
2024-09-01 20:25:55 -07:00
2025-08-11 23:00:59 -07:00
2025-08-11 23:00:59 -07:00
2025-08-02 12:06:09 -07:00
2025-08-05 16:02:07 +03:00
2025-01-25 20:22:29 -08:00
2025-05-22 14:55:36 -07:00
2025-05-12 23:50:38 -07:00
2025-03-16 22:05:55 -07:00
2025-07-26 15:08:22 -07:00
2025-03-17 00:05:35 -07:00
2025-07-13 16:38:16 -07:00
2025-01-13 22:40:31 -08:00
2025-06-17 10:44:15 +02:00
2025-07-09 22:41:58 -07:00
2025-07-13 16:38:29 -07:00
2025-07-19 18:59:57 -07:00
2023-12-10 16:51:50 -08:00
2024-01-08 15:27:15 -08:00
2025-05-09 13:43:07 +01:00
2025-07-09 22:42:17 -07:00
2025-07-19 18:59:47 -07:00
2025-07-09 22:42:17 -07:00
2024-07-10 12:14:54 -07:00
2025-07-13 16:38:23 -07:00
2024-04-25 20:55:49 -07:00
2025-07-13 16:38:21 -07:00
2025-07-09 22:42:17 -07:00
2024-11-05 16:56:23 -08:00
2025-01-13 22:40:48 -08:00
2025-07-09 22:42:20 -07:00
2025-07-19 18:59:53 -07:00
2025-08-02 12:06:10 -07:00
2025-01-13 22:40:38 -08:00
2025-07-31 14:57:54 -07:00
2024-09-01 20:25:45 -07:00
2025-08-05 16:02:07 +03:00
2025-07-19 18:59:47 -07:00
2025-03-17 00:05:40 -07:00
2024-10-31 20:27:04 -07:00
2024-01-08 15:27:15 -08:00
2025-05-12 23:50:31 -07:00
2025-06-18 13:06:26 +02:00
2025-08-04 10:54:36 -07:00
2025-03-16 22:06:29 -07:00
2025-03-17 22:07:01 -07:00
2025-03-17 22:06:58 -07:00
2025-05-31 15:44:16 -07:00
2025-07-24 19:12:28 -07:00
2025-07-09 22:41:58 -07:00
2025-07-24 19:12:34 -07:00
2025-06-02 16:00:26 -07:00
2025-02-28 11:51:31 -08:00
2025-08-11 23:00:59 -07:00
2025-07-24 19:12:35 -07:00
2025-07-09 22:42:11 -07:00
2025-05-22 14:55:37 -07:00
2025-01-13 22:40:42 -08:00
2025-08-05 16:02:07 +03:00
2025-08-02 12:06:09 -07:00
2025-07-09 21:07:52 -07:00
2025-07-24 19:12:32 -07:00
2025-07-31 14:57:54 -07:00
2025-07-19 18:59:47 -07:00
2025-05-12 23:50:44 -07:00
2025-07-13 16:38:30 -07:00
2025-05-11 17:48:06 -07:00
2025-07-31 14:57:54 -07:00
2025-07-09 22:41:57 -07:00