Re: [PATCH] mm/bpf: Add bpf_mem_cgroup_memory_events_local() kfunc
From: Alexei Starovoitov
Date: Wed Nov 11 2026 - 10:57:17 EST
On Tue, Nov 10, 2026 at 10:56 PM Hongfu Li <hongfu.li@xxxxxxxxx> wrote:
> Expose the local counters to BPF programs with a kfunc, so that a
> policy can attribute events to a specific cgroup instead of only
> seeing the aggregate of the subtree.
No. The prog can do it today without a new kfunc:
memcg = bpf_get_mem_cgroup(css);
if (!memcg)
return 0;
cnt = memcg->memory_events_local[MEMCG_OOM_KILL].counter;
bpf_put_mem_cgroup(memcg);
memcg is a trusted pointer to a struct that is in BTF.
pw-bot: cr