Re: [PATCH] memcg: net: track network throttling due to memcg memory pressure
From: Kuniyuki Iwashima
Date: Thu Oct 16 2025 - 01:47:10 EST
On Wed, Oct 15, 2025 at 6:40 PM Roman Gushchin <roman.gushchin@xxxxxxxxx> wrote:
>
> Shakeel Butt <shakeel.butt@xxxxxxxxx> writes:
>
> > The kernel can throttle network sockets if the memory cgroup associated
> > with the corresponding socket is under memory pressure. The throttling
> > actions include clamping the transmit window, failing to expand receive
> > or send buffers, aggressively prune out-of-order receive queue, FIN
> > deferred to a retransmitted packet and more. Let's add memcg metric to
> > indicate track such throttling actions.
> >
> > At the moment memcg memory pressure is defined through vmpressure and in
> > future it may be defined using PSI or we may add more flexible way for
> > the users to define memory pressure, maybe through ebpf. However the
> > potential throttling actions will remain the same, so this newly
> > introduced metric will continue to track throttling actions irrespective
> > of how memcg memory pressure is defined.
> >
> > Signed-off-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> > ---
> > Documentation/admin-guide/cgroup-v2.rst | 4 ++++
> > include/linux/memcontrol.h | 1 +
> > include/net/sock.h | 6 +++++-
> > kernel/cgroup/cgroup.c | 1 +
> > mm/memcontrol.c | 3 +++
> > 5 files changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
> > index 0e6c67ac585a..057ee95e43ef 100644
> > --- a/Documentation/admin-guide/cgroup-v2.rst
> > +++ b/Documentation/admin-guide/cgroup-v2.rst
> > @@ -1515,6 +1515,10 @@ The following nested keys are defined.
> > oom_group_kill
> > The number of times a group OOM has occurred.
> >
> > + socks_throttled
> > + The number of times network sockets associated with
> > + this cgroup are throttled.
>
> I'd prefer sockets_throttled or sock_throttled. And same for the
> constant name.
>
> Otherwise,
> Acked-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
+1 for sock_ like "sock" in memory.stat and its MEMCG_SOCK.
Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
Thanks!