[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201125030119.2864302-14-guro@fb.com>
Date: Tue, 24 Nov 2020 19:00:58 -0800
From: Roman Gushchin <guro@...com>
To: <bpf@...r.kernel.org>
CC: <ast@...nel.org>, <daniel@...earbox.net>, <netdev@...r.kernel.org>,
<andrii@...nel.org>, <akpm@...ux-foundation.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<kernel-team@...com>
Subject: [PATCH bpf-next v8 13/34] 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@...com>
---
kernel/bpf/lpm_trie.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
index 00e32f2ec3e6..a7d1e5cb80da 100644
--- a/kernel/bpf/lpm_trie.c
+++ b/kernel/bpf/lpm_trie.c
@@ -282,8 +282,9 @@ 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 | __GFP_ACCOUNT,
+ trie->map.numa_node);
if (!node)
return NULL;
@@ -557,7 +558,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);
--
2.26.2
Powered by blists - more mailing lists