Skip to content

Commit a37fb7e

Browse files
Roman GushchinAlexei Starovoitov
authored andcommitted
bpf: Eliminate rlimit-based memory accounting for queue_stack_maps maps
Do not use rlimit-based memory accounting for queue_stack maps. It has been replaced with the memcg-based memory accounting. 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-26-guro@fb.com
1 parent cbddcb5 commit a37fb7e

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

‎kernel/bpf/queue_stack_maps.c‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,21 @@ static int queue_stack_map_alloc_check(union bpf_attr *attr)
6666

6767
static struct bpf_map *queue_stack_map_alloc(union bpf_attr *attr)
6868
{
69-
int ret, numa_node = bpf_map_attr_numa_node(attr);
70-
struct bpf_map_memory mem = {0};
69+
int numa_node = bpf_map_attr_numa_node(attr);
7170
struct bpf_queue_stack *qs;
72-
u64 size, queue_size, cost;
71+
u64 size, queue_size;
7372

7473
size = (u64) attr->max_entries + 1;
75-
cost = queue_size = sizeof(*qs) + size * attr->value_size;
76-
77-
ret = bpf_map_charge_init(&mem, cost);
78-
if (ret < 0)
79-
return ERR_PTR(ret);
74+
queue_size = sizeof(*qs) + size * attr->value_size;
8075

8176
qs = bpf_map_area_alloc(queue_size, numa_node);
82-
if (!qs) {
83-
bpf_map_charge_finish(&mem);
77+
if (!qs)
8478
return ERR_PTR(-ENOMEM);
85-
}
8679

8780
memset(qs, 0, sizeof(*qs));
8881

8982
bpf_map_init_from_attr(&qs->map, attr);
9083

91-
bpf_map_charge_move(&qs->map.memory, &mem);
9284
qs->size = size;
9385

9486
raw_spin_lock_init(&qs->lock);

0 commit comments

Comments
 (0)