BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v4 0/2] memcg accounting for BPF arena
@ 2026-01-02 18:13 Puranjay Mohan
  2026-01-02 18:13 ` [PATCH bpf-next v4 1/2] bpf: syscall: Introduce memcg enter/exit helpers Puranjay Mohan
  2026-01-02 18:13 ` [PATCH bpf-next v4 2/2] bpf: arena: Reintroduce memcg accounting Puranjay Mohan
  0 siblings, 2 replies; 5+ messages in thread
From: Puranjay Mohan @ 2026-01-02 18:13 UTC (permalink / raw)
  To: bpf
  Cc: Puranjay Mohan, Puranjay Mohan, Alexei Starovoitov,
	Andrii Nakryiko, Daniel Borkmann, Martin KaFai Lau,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, kernel-team

v3: https://lore.kernel.org/all/20260102151852.570285-1-puranjay@kernel.org/
Changes in v3->v4:
- Do memcg set/recover in arena_reserve_pages() rather than
  bpf_arena_reserve_pages() for symmetry with other kfuncs (Alexei)

v2: https://lore.kernel.org/all/20251231141434.3416822-1-puranjay@kernel.org/
Changes in v2->v3:
- Remove memcg accounting from bpf_map_alloc_pages() as the caller does
  it already. (Alexei)
- Do memcg set/recover in arena_alloc/free_pages() rather than
  bpf_arena_alloc/free_pages(), it reduces copy pasting in
  sleepable/non_sleepable functions.

v1: https://lore.kernel.org/all/20251230153006.1347742-1-puranjay@kernel.org/
Changes in v1->v2:
- Return both pointers through arguments from bpf_map_memcg_enter and
  make it return void. (Alexei)
- Add memcg accounting in arena_free_worker (AI)

This set adds memcg accounting logic into arena kfuncs and other places
that do allocations in arena.c.

Puranjay Mohan (2):
  bpf: syscall: Introduce memcg enter/exit helpers
  bpf: arena: Reintroduce memcg accounting

 include/linux/bpf.h     | 15 ++++++++++++
 kernel/bpf/arena.c      | 29 ++++++++++++++++++++---
 kernel/bpf/range_tree.c |  5 ++--
 kernel/bpf/syscall.c    | 52 +++++++++++++++++++----------------------
 4 files changed, 68 insertions(+), 33 deletions(-)


base-commit: c286e7e9d1f1f3d90ad11c37e896f582b02d19c4
-- 
2.47.3


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

end of thread, other threads:[~2026-01-02 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 18:13 [PATCH bpf-next v4 0/2] memcg accounting for BPF arena Puranjay Mohan
2026-01-02 18:13 ` [PATCH bpf-next v4 1/2] bpf: syscall: Introduce memcg enter/exit helpers Puranjay Mohan
2026-01-02 18:13 ` [PATCH bpf-next v4 2/2] bpf: arena: Reintroduce memcg accounting Puranjay Mohan
2026-01-02 19:39   ` Alexei Starovoitov
2026-01-02 20:03     ` Puranjay Mohan

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