Skip to content

Commit 6d192c7

Browse files
Roman GushchinAlexei Starovoitov
authored andcommitted
bpf: Refine memcg-based memory accounting for arraymap maps
Include percpu arrays and auxiliary data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin <guro@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20201201215900.3569844-9-guro@fb.com
1 parent d5299b6 commit 6d192c7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎kernel/bpf/arraymap.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ static int bpf_array_alloc_percpu(struct bpf_array *array)
3434
int i;
3535

3636
for (i = 0; i < array->map.max_entries; i++) {
37-
ptr = __alloc_percpu_gfp(array->elem_size, 8,
38-
GFP_USER | __GFP_NOWARN);
37+
ptr = bpf_map_alloc_percpu(&array->map, array->elem_size, 8,
38+
GFP_USER | __GFP_NOWARN);
3939
if (!ptr) {
4040
bpf_array_free_percpu(array);
4141
return -ENOMEM;
@@ -1018,7 +1018,7 @@ static struct bpf_map *prog_array_map_alloc(union bpf_attr *attr)
10181018
struct bpf_array_aux *aux;
10191019
struct bpf_map *map;
10201020

1021-
aux = kzalloc(sizeof(*aux), GFP_KERNEL);
1021+
aux = kzalloc(sizeof(*aux), GFP_KERNEL_ACCOUNT);
10221022
if (!aux)
10231023
return ERR_PTR(-ENOMEM);
10241024

0 commit comments

Comments
 (0)