From c84ac52917dff87fa83dabc13f4977ea6e3b3c8d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 2 Feb 2024 22:53:11 +0000 Subject: [PATCH] Revert "bpf: add percpu stats for bpf_map elements insertions/deletions" This reverts commit a6fb03a9c9c88941d35c63b83f3319731bf685a2 which is commit 25954730461af01f66afa9e17036b051986b007e upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Idf75ac8d96a98127aac4ccf1d0c78dd4668f5664 Signed-off-by: Greg Kroah-Hartman --- include/linux/bpf.h | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index b013f622c2b0..f2899c878aa3 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -253,7 +253,6 @@ struct bpf_map { } owner; bool bypass_spec_v1; bool frozen; /* write-once; write-protected by freeze_mutex */ - s64 __percpu *elem_count; }; static inline bool map_value_has_spin_lock(const struct bpf_map *map) @@ -1804,35 +1803,6 @@ bpf_map_alloc_percpu(const struct bpf_map *map, size_t size, size_t align, } #endif -static inline int -bpf_map_init_elem_count(struct bpf_map *map) -{ - size_t size = sizeof(*map->elem_count), align = size; - gfp_t flags = GFP_USER | __GFP_NOWARN; - - map->elem_count = bpf_map_alloc_percpu(map, size, align, flags); - if (!map->elem_count) - return -ENOMEM; - - return 0; -} - -static inline void -bpf_map_free_elem_count(struct bpf_map *map) -{ - free_percpu(map->elem_count); -} - -static inline void bpf_map_inc_elem_count(struct bpf_map *map) -{ - this_cpu_inc(*map->elem_count); -} - -static inline void bpf_map_dec_elem_count(struct bpf_map *map) -{ - this_cpu_dec(*map->elem_count); -} - extern int sysctl_unprivileged_bpf_disabled; static inline bool bpf_allow_ptr_leaks(void)