[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ldnooue4.fsf@linux.dev>
Date: Tue, 12 Aug 2025 18:57:55 -0700
From: Roman Gushchin <roman.gushchin@...ux.dev>
To: Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Neal Cardwell
<ncardwell@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Willem de
Bruijn <willemb@...gle.com>, Matthieu Baerts <matttbe@...nel.org>, Mat
Martineau <martineau@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>, Shakeel Butt <shakeel.butt@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>, Michal Koutný
<mkoutny@...e.com>, Tejun Heo <tj@...nel.org>, Simon Horman
<horms@...nel.org>, Geliang Tang <geliang@...nel.org>, Muchun Song
<muchun.song@...ux.dev>, Mina Almasry <almasrymina@...gle.com>, Kuniyuki
Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org,
mptcp@...ts.linux.dev, cgroups@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v3 net-next 12/12] net-memcg: Decouple controlled memcg
from global protocol memory accounting.
Kuniyuki Iwashima <kuniyu@...gle.com> writes:
> 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.
>
> When running under a non-root cgroup, this memory is also charged to the
> memcg as "sock" in memory.stat.
>
> Even when a memcg controls memory usage, sockets of such protocols are
> still subject to global limits (e.g., /proc/sys/net/ipv4/tcp_mem).
>
> This makes it difficult to accurately estimate and configure appropriate
> global limits, especially in multi-tenant environments.
>
> If all workloads were guaranteed to be controlled under memcg, the issue
> could be worked around by setting tcp_mem[0~2] to UINT_MAX.
>
> In reality, this assumption does not always hold, and processes that
> belong to the root cgroup or opt out of memcg can consume memory up to
> the global limit, becoming a noisy neighbour.
>
> Let's decouple memcg from the global per-protocol memory accounting if
> it has a finite memory.max (!= "max").
I think you can't make the new behavior as the new default, simple because
it might break existing setups. Basically anyone who is using memory.max
will suddenly have their processes being opted out of the net memory
accounting. Idk how many users are actually relying on the network
memory accounting, but I believe way more than 0.
So I guess a net sysctl/some other knob is warranted here, with the old
behavior being the default.
Thanks
Powered by blists - more mailing lists