Re: [PATCH v6 bpf-next/net 0/5] bpf: Allow decoupling memcg from sk->sk_prot->memory_allocated.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 8, 2025 at 4:47 PM Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote:
>
> Let me quickly give couple of high level comments.
>
> On Mon, Sep 08, 2025 at 10:34:34PM +0000, Kuniyuki Iwashima wrote:
> > Some protocols (e.g., TCP, UDP) have their own memory accounting for
> > socket buffers and charge memory to global per-protocol counters such
> > as /proc/net/ipv4/tcp_mem.
> >
> > When running under a non-root cgroup,
>
> Remove this non-root cgroup as we may change in future to also associate
> with root memcg for stat purpose. In addition, we may switch sk pointing
> to objcg instead of memcg.

Makes sense.  Will remove the part.

>
> > this memory is also charged to
> > the memcg as sock in memory.stat.
> >
> > We do not need to pay costs for two orthogonal memory accounting
> > mechanisms.
> >
> > This series allows decoupling memcg from the global memory accounting
> > (memcg + tcp_mem -> memcg) if socket is configured as such by BPF prog.
> >
>
> I understand that you need fine grained control but I see more users
> interested in system level settings i.e. either through config, boot
> param or sysctl, let the user/admin disable protocol specific accounting
> if memcg is enabled.

Considering tcp/udp/sctp sockets are not created in the early
boot stage, I think sysctl would be enough and we don't need to
control the default value with a boot param (sysctl.conf would be
early enough).


>
> Please rename SK_BPF_MEMCG_SOCK_ISOLATED to something more appropriate.
> The isolated word is giving wrong impression. We want something which
> specify that the kernel is only doing memcg accounting and not protocol
> specific accounting for this socket. So, something like
> SK_BPF_MEMCG_ONLY make more sense.

Maybe _EXCLUSIVE would be a bit clearer ?

net.core.memcg_exclusive (sysctl)
SK_BPF_MEMCG_EXCLUSIVE

or much clearer but lengthy ones ?

net.core.memcg_no_per_protocol_account
SK_BPF_MEMCG_NO_PER_PROTOCOL_ACCOUNT

net.core.memcg_no_global_account
SK_BPF_MEMCG_NO_GLOBAL_ACCOUNT

I'm bad at naming.  Do you have any preference ?





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux