mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-21 04:53:46 -04:00
bpf: Eliminate rlimit-based memory accounting infra for bpf maps
Remove rlimit-based accounting infrastructure code, which is not used anymore. To provide a backward compatibility, use an approximation of the bpf map memory footprint as a "memlock" value, available to a user via map info. The approximation is based on the maximal number of elements and key and value sizes. Signed-off-by: Roman Gushchin <guro@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20201201215900.3569844-33-guro@fb.com
This commit is contained in:
committed by
Alexei Starovoitov
parent
ab31be378a
commit
80ee81e040
@@ -26,17 +26,12 @@ __u32 g_line = 0;
|
||||
return 0; \
|
||||
})
|
||||
|
||||
struct bpf_map_memory {
|
||||
__u32 pages;
|
||||
} __attribute__((preserve_access_index));
|
||||
|
||||
struct bpf_map {
|
||||
enum bpf_map_type map_type;
|
||||
__u32 key_size;
|
||||
__u32 value_size;
|
||||
__u32 max_entries;
|
||||
__u32 id;
|
||||
struct bpf_map_memory memory;
|
||||
} __attribute__((preserve_access_index));
|
||||
|
||||
static inline int check_bpf_map_fields(struct bpf_map *map, __u32 key_size,
|
||||
@@ -47,7 +42,6 @@ static inline int check_bpf_map_fields(struct bpf_map *map, __u32 key_size,
|
||||
VERIFY(map->value_size == value_size);
|
||||
VERIFY(map->max_entries == max_entries);
|
||||
VERIFY(map->id > 0);
|
||||
VERIFY(map->memory.pages > 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -60,7 +54,6 @@ static inline int check_bpf_map_ptr(struct bpf_map *indirect,
|
||||
VERIFY(indirect->value_size == direct->value_size);
|
||||
VERIFY(indirect->max_entries == direct->max_entries);
|
||||
VERIFY(indirect->id == direct->id);
|
||||
VERIFY(indirect->memory.pages == direct->memory.pages);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user