Skip to content

Commit db54330

Browse files
Roman GushchinAlexei Starovoitov
authored andcommitted
bpf: Eliminate rlimit-based memory accounting for reuseport_array maps
Do not use rlimit-based memory accounting for reuseport_array 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-27-guro@fb.com
1 parent a37fb7e commit db54330

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

‎kernel/bpf/reuseport_array.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ static void reuseport_array_free(struct bpf_map *map)
150150

151151
static struct bpf_map *reuseport_array_alloc(union bpf_attr *attr)
152152
{
153-
int err, numa_node = bpf_map_attr_numa_node(attr);
153+
int numa_node = bpf_map_attr_numa_node(attr);
154154
struct reuseport_array *array;
155-
struct bpf_map_memory mem;
156155
u64 array_size;
157156

158157
if (!bpf_capable())
@@ -161,20 +160,13 @@ static struct bpf_map *reuseport_array_alloc(union bpf_attr *attr)
161160
array_size = sizeof(*array);
162161
array_size += (u64)attr->max_entries * sizeof(struct sock *);
163162

164-
err = bpf_map_charge_init(&mem, array_size);
165-
if (err)
166-
return ERR_PTR(err);
167-
168163
/* allocate all map elements and zero-initialize them */
169164
array = bpf_map_area_alloc(array_size, numa_node);
170-
if (!array) {
171-
bpf_map_charge_finish(&mem);
165+
if (!array)
172166
return ERR_PTR(-ENOMEM);
173-
}
174167

175168
/* copy mandatory map attributes */
176169
bpf_map_init_from_attr(&array->map, attr);
177-
bpf_map_charge_move(&array->map.memory, &mem);
178170

179171
return &array->map;
180172
}

0 commit comments

Comments
 (0)