Skip to content

bpf: bpf maps memory accounting cleanup

Roman Gushchin bpf lkml 1 version Applied

Status from this message: Applied. Thanks

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 7 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5bpf: add memlock precharge check for cgroup_local_storagekernel/bpf/local_storage.c+9 -21 reply
2/5bpf: add memlock precharge for socket local storagenet/core/bpf_sk_storage.c+10 -21 reply
3/5bpf: group memory related fields in struct bpf_map_memoryinclude/linux/bpf.h kernel/bpf/arraymap.c kernel/bpf/cpumap.c +11 more+36 -311 reply
4/5bpf: rework memlock-based memory accounting for mapsinclude/linux/bpf.h kernel/bpf/arraymap.c kernel/bpf/cpumap.c +11 more+112 -881 reply
5/5bpf: move memory size checks to bpf_map_charge_init()include/linux/bpf.h kernel/bpf/arraymap.c kernel/bpf/cpumap.c +11 more+20 -672 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchSong Liu
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

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

Read the v1 thread

Cover letter [PATCH bpf-next 0/5] bpf: bpf maps memory accounting cleanup

During my work on memcg-based memory accounting for bpf maps I've done some cleanups and refactorings of the existing memlock rlimit-based code. It makes it more robust, unifies size to pages conversion, size checks and corresponding error codes. Also it adds coverage for cgroup local storage and socket local storage maps.

It looks like some preliminary work on the mm side might be required to start working on the memcg-based accounting, so I'm sending these patches as a separate patchset.

Roman Gushchin (5):
bpf: add memlock precharge check for cgroup_local_storage
bpf: add memlock precharge for socket local storage
bpf: group memory related fields in struct bpf_map_memory
bpf: rework memlock-based memory accounting for maps
bpf: move memory size checks to bpf_map_charge_init()

 include/linux/bpf.h           | 15 ++++--
 kernel/bpf/arraymap.c         | 18 ++++----
 kernel/bpf/cpumap.c           |  9 ++--
 kernel/bpf/devmap.c           | 14 +++---
 kernel/bpf/hashtab.c          | 14 ++----
 kernel/bpf/local_storage.c    | 13 ++++--
 kernel/bpf/lpm_trie.c         |  8 +---
 kernel/bpf/queue_stack_maps.c | 13 +++---
 kernel/bpf/reuseport_array.c  | 17 +++----
 kernel/bpf/stackmap.c         | 28 ++++++-----
 kernel/bpf/syscall.c          | 87 ++++++++++++++++++-----------------
 kernel/bpf/xskmap.c           | 10 ++--
 net/core/bpf_sk_storage.c     | 12 ++++-
 net/core/sock_map.c           |  9 +---
 14 files changed, 132 insertions(+), 135 deletions(-)
Signature · 1 line
2.20.1