[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251220041250.372179-1-roman.gushchin@linux.dev>
Date: Fri, 19 Dec 2025 20:12:43 -0800
From: Roman Gushchin <roman.gushchin@...ux.dev>
To: bpf@...r.kernel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: JP Kobryn <inwardvessel@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Shakeel Butt <shakeel.butt@...ux.dev>,
Michal Hocko <mhocko@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <roman.gushchin@...ux.dev>
Subject: [PATCH bpf-next v2 0/7] mm: bpf kfuncs to access memcg data
Introduce kfuncs to simplify the access to the memcg data.
These kfuncs can be used to accelerate monitoring use cases and
for implementing custom OOM policies once BPF OOM is landed.
This patchset was separated out from the BPF OOM patchset to simplify
the logistics and accelerate the landing of the part which is useful
by itself. No functional changes since BPF OOM v2.
v2:
- added mem_cgroup_disabled() checks (by Shakeel B.)
- added special handling of the root memcg in bpf_mem_cgroup_usage()
(by Shakeel B.)
- minor fixes in the kselftest (by Shakeel B.)
- added a MAINTAINERS entry (by Shakeel B.)
v1:
https://lore.kernel.org/bpf/87ike29s5r.fsf@linux.dev/T/#t
JP Kobryn (2):
mm: introduce BPF kfunc to access memory events
bpf: selftests: selftests for memcg stat kfuncs
Roman Gushchin (5):
mm: declare memcg_page_state_output() in memcontrol.h
mm: introduce BPF kfuncs to deal with memcg pointers
mm: introduce bpf_get_root_mem_cgroup() BPF kfunc
mm: introduce BPF kfuncs to access memcg statistics and events
MAINTAINERS: add an entry for MM BPF extensions
MAINTAINERS | 7 +
include/linux/memcontrol.h | 3 +
mm/Makefile | 3 +
mm/bpf_memcontrol.c | 179 ++++++++++++++
mm/memcontrol-v1.h | 1 -
.../testing/selftests/bpf/cgroup_iter_memcg.h | 18 ++
.../bpf/prog_tests/cgroup_iter_memcg.c | 223 ++++++++++++++++++
.../selftests/bpf/progs/cgroup_iter_memcg.c | 39 +++
8 files changed, 472 insertions(+), 1 deletion(-)
create mode 100644 mm/bpf_memcontrol.c
create mode 100644 tools/testing/selftests/bpf/cgroup_iter_memcg.h
create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c
create mode 100644 tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c
--
2.52.0
Powered by blists - more mailing lists