bpf: allow to disable bpf map memory accounting
authorYafang Shao <laoar.shao@gmail.com>
Fri, 10 Feb 2023 15:47:33 +0000 (15:47 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 11 Feb 2023 02:59:57 +0000 (18:59 -0800)
commitee53cbfb1ebf990de0d084a7cd6b67b05fe1f7ac
tree84caf90a458c9dbead8cb0c2fcdf0dc75d8a5a1f
parentddef81b5fd1da4d7c3cc8785d2043b73b72f38ef
bpf: allow to disable bpf map memory accounting

We can simply set root memcg as the map's memcg to disable bpf memory
accounting. bpf_map_area_alloc is a little special as it gets the memcg
from current rather than from the map, so we need to disable GFP_ACCOUNT
specifically for it.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Link: https://lore.kernel.org/r/20230210154734.4416-4-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/memalloc.c
kernel/bpf/syscall.c