diff options
author | Kirill Tkhai <ktkhai@virtuozzo.com> | 2018-03-01 15:23:28 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-07 18:19:10 +0300 |
commit | 30855ffc29b972d3316e2adcf8029c00c36fad60 (patch) | |
tree | cbac1df04ca36f33c22cc6db718ff35732863b40 /net/core/net_namespace.c | |
parent | 0f3e9c97eb5a97972b0c0076a5cc01bb142f8e70 (diff) | |
download | linux-30855ffc29b972d3316e2adcf8029c00c36fad60.tar.xz |
net: Make account struct net to memcg
The patch adds SLAB_ACCOUNT to flags of net_cachep cache,
which enables accounting of struct net memory to memcg kmem.
Since number of net_namespaces may be significant, user
want to know, how much there were consumed, and control.
Note, that we do not account net_generic to the same memcg,
where net was accounted, moreover, we don't do this at all (*).
We do not want the situation, when single memcg memory deficit
prevents us to register new pernet_operations.
(*)Even despite there is !current process accounting already
available in linux-next. See kmalloc_memcg() there for the details.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r-- | net/core/net_namespace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 690e78c6af45..c340d5cfbdec 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -882,7 +882,7 @@ static int __init net_ns_init(void) #ifdef CONFIG_NET_NS net_cachep = kmem_cache_create("net_namespace", sizeof(struct net), SMP_CACHE_BYTES, - SLAB_PANIC, NULL); + SLAB_PANIC|SLAB_ACCOUNT, NULL); /* Create workqueue for cleanup */ netns_wq = create_singlethread_workqueue("netns"); |