Skip to content

Commit 30855ff

Browse files
Kirill Tkhaidavem330
authored andcommitted
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>
1 parent 0f3e9c9 commit 30855ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/net_namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ static int __init net_ns_init(void)
882882
#ifdef CONFIG_NET_NS
883883
net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
884884
SMP_CACHE_BYTES,
885-
SLAB_PANIC, NULL);
885+
SLAB_PANIC|SLAB_ACCOUNT, NULL);
886886

887887
/* Create workqueue for cleanup */
888888
netns_wq = create_singlethread_workqueue("netns");

0 commit comments

Comments
 (0)