[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201117034108.1186569-12-guro@fb.com>
Date: Mon, 16 Nov 2020 19:40:45 -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 v6 11/34] bpf: refine memcg-based memory accounting for devmap maps
Include map metadata and the node size (struct bpf_dtab_netdev)
into the accounting.
Signed-off-by: Roman Gushchin <guro@...com>
Acked-by: Song Liu <songliubraving@...com>
---
kernel/bpf/devmap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 2b5ca93c17de..e75e12ae624e 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -175,7 +175,7 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
if (!capable(CAP_NET_ADMIN))
return ERR_PTR(-EPERM);
- dtab = kzalloc(sizeof(*dtab), GFP_USER);
+ dtab = kzalloc(sizeof(*dtab), GFP_USER | __GFP_ACCOUNT);
if (!dtab)
return ERR_PTR(-ENOMEM);
@@ -602,7 +602,8 @@ static struct bpf_dtab_netdev *__dev_map_alloc_node(struct net *net,
struct bpf_prog *prog = NULL;
struct bpf_dtab_netdev *dev;
- dev = kmalloc_node(sizeof(*dev), GFP_ATOMIC | __GFP_NOWARN,
+ dev = kmalloc_node(sizeof(*dev),
+ GFP_ATOMIC | __GFP_NOWARN | __GFP_ACCOUNT,
dtab->map.numa_node);
if (!dev)
return ERR_PTR(-ENOMEM);
--
2.26.2
Powered by blists - more mailing lists