Revert "bpf: add percpu stats for bpf_map elements insertions/deletions"

This reverts commit a6fb03a9c9 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 <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2024-02-02 22:53:11 +00:00
parent 0125855f7e
commit c84ac52917

View File

@ -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)