[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dcc22c04-94fb-4e1c-a69f-b033078867c7@linux.dev>
Date: Wed, 17 Sep 2025 12:18:28 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Kuniyuki Iwashima <kuniyu@...gle.com>,
Shakeel Butt <shakeel.butt@...ux.dev>, Johannes Weiner <hannes@...xchg.org>
Cc: Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Stanislav Fomichev <sdf@...ichev.me>, Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Neal Cardwell <ncardwell@...gle.com>, Willem de Bruijn <willemb@...gle.com>,
Mina Almasry <almasrymina@...gle.com>, Kuniyuki Iwashima
<kuni1840@...il.com>, bpf@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v8 bpf-next/net 2/6] net-memcg: Allow decoupling memcg
from global protocol memory accounting.
On 9/10/25 12:19 PM, Kuniyuki Iwashima wrote:
> Some protocols (e.g., TCP, UDP) implement memory accounting for socket
> buffers and charge memory to per-protocol global counters pointed to by
> sk->sk_proto->memory_allocated.
>
> If a socket has sk->sk_memcg, this memory is also charged to memcg as
> "sock" in memory.stat.
>
> We do not need to pay costs for two orthogonal memory accounting
> mechanisms. A microbenchmark result is in the subsequent bpf patch.
>
> Let's decouple sockets under memcg from the global per-protocol memory
> accounting if mem_cgroup_sk_exclusive() returns true.
>
> Note that this does NOT disable memcg, but rather the per-protocol one.
The bpf side changes look reasonable. I believe the commit message in v8 has
clarified the reason and its behavior. memcg reviewers, please take a look.
Powered by blists - more mailing lists