diff mbox series

[bpf-next,v7,17/34] bpf: refine memcg-based memory accounting for xskmap maps

Message ID 20201119173754.4125257-18-guro@fb.com (mailing list archive)
State New, archived
Headers show
Series bpf: switch to memcg-based memory accounting | expand

Commit Message

Roman Gushchin Nov. 19, 2020, 5:37 p.m. UTC
Extend xskmap memory accounting to include the memory taken by
the xsk_map_node structure.

Signed-off-by: Roman Gushchin <guro@fb.com>
---
 net/xdp/xskmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Song Liu Nov. 20, 2020, 1:45 a.m. UTC | #1
> On Nov 19, 2020, at 9:37 AM, Roman Gushchin <guro@fb.com> wrote:
> 
> Extend xskmap memory accounting to include the memory taken by
> the xsk_map_node structure.
> 
> Signed-off-by: Roman Gushchin <guro@fb.com>

Acked-by: Song Liu <songliubraving@fb.com>
diff mbox series

Patch

diff --git a/net/xdp/xskmap.c b/net/xdp/xskmap.c
index 49da2b8ace8b..eceea51182d9 100644
--- a/net/xdp/xskmap.c
+++ b/net/xdp/xskmap.c
@@ -28,7 +28,9 @@  static struct xsk_map_node *xsk_map_node_alloc(struct xsk_map *map,
 	struct xsk_map_node *node;
 	int err;
 
-	node = kzalloc(sizeof(*node), GFP_ATOMIC | __GFP_NOWARN);
+	node = bpf_map_kmalloc_node(&map->map, sizeof(*node),
+				    GFP_ATOMIC | __GFP_NOWARN | __GFP_ZERO |
+				    __GFP_ACCOUNT, NUMA_NO_NODE);
 	if (!node)
 		return ERR_PTR(-ENOMEM);