Skip to content

mm: bpf kfuncs to access memcg data

Roman Gushchin bpf linux-mm lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 16 repliesIn review
  2. v36 patches 2 repliesSuperseded
  3. v27 patches 15 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v16 patches14 repliesSuperseded

Changes in v4 from the cover letter

- refactored memcg vm event and stat item idx checks (by Alexei)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6mm: declare memcg_page_state_output() in memcontrol.hinclude/linux/memcontrol.h mm/memcontrol-v1.h+6 -10 replies
2/6mm: introduce BPF kfuncs to deal with memcg pointersmm/Makefile mm/bpf_memcontrol.c+91 -00 replies
3/6mm: introduce bpf_get_root_mem_cgroup() BPF kfuncmm/bpf_memcontrol.c+20 -010 replies
4/6mm: introduce BPF kfuncs to access memcg statistics and eventsinclude/linux/memcontrol.h mm/bpf_memcontrol.c mm/memcontrol.c+115 -00 replies
5/6bpf: selftests: selftests for memcg stat kfuncstools/testing/selftests/bpf/cgroup_iter_memcg.h tools/testing/selftests/bpf/prog_tests/cgroup_iter_memcg.c tools/testing/selftests/bpf/progs/cgroup_iter_memcg.c+280 -00 replies
6/6MAINTAINERS: add an entry for MM BPF extensionsMAINTAINERS+9 -00 replies

Reviews trailers per patch

1 of 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMichal HockoShakeel Butt
SeriesA-b
1/6A-b A-b
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH bpf-next v4 0/6] 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.

v4:
- refactored memcg vm event and stat item idx checks (by Alexei)

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/[email protected]/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                               |  16 ++
 .../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, 521 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
Signature · 1 line
2.52.0