Commit 6d192c79 authored by Roman Gushchin's avatar Roman Gushchin Committed by Alexei Starovoitov

bpf: Refine memcg-based memory accounting for arraymap maps

Include percpu arrays and auxiliary data into the memcg-based memory
accounting.
Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201201215900.3569844-9-guro@fb.com
parent d5299b67
...@@ -34,7 +34,7 @@ static int bpf_array_alloc_percpu(struct bpf_array *array) ...@@ -34,7 +34,7 @@ static int bpf_array_alloc_percpu(struct bpf_array *array)
int i; int i;
for (i = 0; i < array->map.max_entries; i++) { for (i = 0; i < array->map.max_entries; i++) {
ptr = __alloc_percpu_gfp(array->elem_size, 8, ptr = bpf_map_alloc_percpu(&array->map, array->elem_size, 8,
GFP_USER | __GFP_NOWARN); GFP_USER | __GFP_NOWARN);
if (!ptr) { if (!ptr) {
bpf_array_free_percpu(array); bpf_array_free_percpu(array);
...@@ -1018,7 +1018,7 @@ static struct bpf_map *prog_array_map_alloc(union bpf_attr *attr) ...@@ -1018,7 +1018,7 @@ static struct bpf_map *prog_array_map_alloc(union bpf_attr *attr)
struct bpf_array_aux *aux; struct bpf_array_aux *aux;
struct bpf_map *map; struct bpf_map *map;
aux = kzalloc(sizeof(*aux), GFP_KERNEL); aux = kzalloc(sizeof(*aux), GFP_KERNEL_ACCOUNT);
if (!aux) if (!aux)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment