Thread (10 messages) 10 messages, 3 authors, 2025-09-17

Re: [PATCH v8 bpf-next/net 2/6] net-memcg: Allow decoupling memcg from global protocol memory accounting.

From: Martin KaFai Lau <martin.lau@linux.dev>
Date: 2025-09-17 19:18:42
Also in: bpf

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help