summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2020-12-01 13:58:39 -0800
committerAlexei Starovoitov <ast@kernel.org>2020-12-02 18:32:45 -0800
commit353e7af4bf5e7247c35e9ba5beab42904f1b3499 (patch)
tree1f833632f298ca663d5d4686e9a4994c84fc4b8b /kernel
parent881456811a33b9d3952897f4d01ee4d74fa2f30e (diff)
downloadlinux-stable-353e7af4bf5e7247c35e9ba5beab42904f1b3499.tar.gz
linux-stable-353e7af4bf5e7247c35e9ba5beab42904f1b3499.tar.bz2
linux-stable-353e7af4bf5e7247c35e9ba5beab42904f1b3499.zip
bpf: Memcg-based memory accounting for lpm_trie maps
Include lpm trie and lpm trie node objects 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-14-guro@fb.com
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/lpm_trie.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
index 00e32f2ec3e6..1a6981203d7f 100644
--- a/kernel/bpf/lpm_trie.c
+++ b/kernel/bpf/lpm_trie.c
@@ -282,8 +282,8 @@ static struct lpm_trie_node *lpm_trie_node_alloc(const struct lpm_trie *trie,
if (value)
size += trie->map.value_size;
- node = kmalloc_node(size, GFP_ATOMIC | __GFP_NOWARN,
- trie->map.numa_node);
+ node = bpf_map_kmalloc_node(&trie->map, size, GFP_ATOMIC | __GFP_NOWARN,
+ trie->map.numa_node);
if (!node)
return NULL;
@@ -557,7 +557,7 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr)
attr->value_size > LPM_VAL_SIZE_MAX)
return ERR_PTR(-EINVAL);
- trie = kzalloc(sizeof(*trie), GFP_USER | __GFP_NOWARN);
+ trie = kzalloc(sizeof(*trie), GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT);
if (!trie)
return ERR_PTR(-ENOMEM);