* [PATCH net-next] net: Make account struct net to memcg
@ 2018-03-01 12:23 Kirill Tkhai
2018-03-07 15:19 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kirill Tkhai @ 2018-03-01 12:23 UTC (permalink / raw)
To: davem, ktkhai, avagin, ebiederm, fw, nicolas.dichtel, roman.kapl,
netdev
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>
---
net/core/net_namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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");
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: Make account struct net to memcg
2018-03-01 12:23 [PATCH net-next] net: Make account struct net to memcg Kirill Tkhai
@ 2018-03-07 15:19 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-03-07 15:19 UTC (permalink / raw)
To: ktkhai; +Cc: avagin, ebiederm, fw, nicolas.dichtel, roman.kapl, netdev
From: Kirill Tkhai <ktkhai@virtuozzo.com>
Date: Thu, 01 Mar 2018 15:23:28 +0300
> 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>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-07 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 12:23 [PATCH net-next] net: Make account struct net to memcg Kirill Tkhai
2018-03-07 15:19 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).