sock: Ignore memcg pressure heuristics when raising allocated
authorAbel Wu <wuyun.abel@bytedance.com>
Thu, 19 Oct 2023 12:00:26 +0000 (20:00 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 24 Oct 2023 08:38:30 +0000 (10:38 +0200)
commit66e6369e312d161708786123fb44ecd53ff32d82
tree798153fb8fd8fa1295eb84078d1223ef44b887f4
parent2e12072c67b5f65fc71a569985a1262531fbdc06
sock: Ignore memcg pressure heuristics when raising allocated

Before sockets became aware of net-memcg's memory pressure since
commit e1aab161e013 ("socket: initial cgroup code."), the memory
usage would be granted to raise if below average even when under
protocol's pressure. This provides fairness among the sockets of
same protocol.

That commit changes this because the heuristic will also be
effective when only memcg is under pressure which makes no sense.
So revert that behavior.

After reverting, __sk_mem_raise_allocated() no longer considers
memcg's pressure. As memcgs are isolated from each other w.r.t.
memory accounting, consuming one's budget won't affect others.
So except the places where buffer sizes are needed to be tuned,
allow workloads to use the memory they are provisioned.

Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
Acked-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20231019120026.42215-3-wuyun.abel@bytedance.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/core/sock.c