linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/6] mm: bpf kfuncs to access memcg data
@ 2025-12-22 22:17 Roman Gushchin
  2025-12-22 22:17 ` [PATCH bpf-next v3 1/6] mm: declare memcg_page_state_output() in memcontrol.h Roman Gushchin
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Roman Gushchin @ 2025-12-22 22:17 UTC (permalink / raw)
  To: bpf, linux-mm, linux-kernel
  Cc: JP Kobryn, Alexei Starovoitov, Daniel Borkmann, Shakeel Butt,
	Michal Hocko, Johannes Weiner, Roman Gushchin

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.

v3:
  - dropped redundant kfuncs flags (by Alexei)
  - fixed kdocs warnings (by Alexei)
  - merged memcg stats access patches into one (by Alexei)
  - restored root memcg usage reporting, added a comment
  - added checks for enum boundaries
  - added Shakeel and JP as co-maintainers (by Shakeel)

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 (1):
  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                                   |   9 +
 include/linux/memcontrol.h                    |  20 ++
 mm/Makefile                                   |   3 +
 mm/bpf_memcontrol.c                           | 193 +++++++++++++++
 mm/memcontrol-v1.h                            |   1 -
 mm/memcontrol.c                               |  10 +
 .../testing/selftests/bpf/cgroup_iter_memcg.h |  18 ++
 .../bpf/prog_tests/cgroup_iter_memcg.c        | 223 ++++++++++++++++++
 .../selftests/bpf/progs/cgroup_iter_memcg.c   |  39 +++
 9 files changed, 515 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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-12-23  3:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-22 22:17 [PATCH bpf-next v3 0/6] mm: bpf kfuncs to access memcg data Roman Gushchin
2025-12-22 22:17 ` [PATCH bpf-next v3 1/6] mm: declare memcg_page_state_output() in memcontrol.h Roman Gushchin
2025-12-22 22:17 ` [PATCH bpf-next v3 2/6] mm: introduce BPF kfuncs to deal with memcg pointers Roman Gushchin
2025-12-22 22:17 ` [PATCH bpf-next v3 3/6] mm: introduce bpf_get_root_mem_cgroup() BPF kfunc Roman Gushchin
2025-12-22 22:17 ` [PATCH bpf-next v3 4/6] mm: introduce BPF kfuncs to access memcg statistics and events Roman Gushchin
2025-12-23  2:11   ` Alexei Starovoitov
2025-12-23  3:09     ` Roman Gushchin
2025-12-22 22:17 ` [PATCH bpf-next v3 5/6] bpf: selftests: selftests for memcg stat kfuncs Roman Gushchin
2025-12-22 22:17 ` [PATCH bpf-next v3 6/6] MAINTAINERS: add an entry for MM BPF extensions Roman Gushchin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox