Commit 30855ffc authored by Kirill Tkhai's avatar Kirill Tkhai Committed by David S. Miller

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: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0f3e9c97
...@@ -882,7 +882,7 @@ static int __init net_ns_init(void) ...@@ -882,7 +882,7 @@ static int __init net_ns_init(void)
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
net_cachep = kmem_cache_create("net_namespace", sizeof(struct net), net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
SMP_CACHE_BYTES, SMP_CACHE_BYTES,
SLAB_PANIC, NULL); SLAB_PANIC|SLAB_ACCOUNT, NULL);
/* Create workqueue for cleanup */ /* Create workqueue for cleanup */
netns_wq = create_singlethread_workqueue("netns"); netns_wq = create_singlethread_workqueue("netns");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment