Skip to contentSkip to conversation

memcg: accounting for fib6_nodes cache

PATCH In review Vasily Averin 3 participants 3 messages Mar 9, 2021 – Mar 10, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 2/9 memcg: accounting for fib6_nodes cache

Objects can be created from memcg-limited tasks
but its misuse may lead to host OOM.

---
 net/ipv6/ip6_fib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_fib.c +1 -1
index ef9d022..fa92ed1 100644
@@ -2445,7 +2445,7 @@ int __init fib6_init(void)
 
 	fib6_node_kmem = kmem_cache_create("fib6_nodes",
 					   sizeof(struct fib6_node),
-					   0, SLAB_HWCACHE_ALIGN,
+					   0, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
 					   NULL);
 	if (!fib6_node_kmem)
 		goto out;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 14 lines · Vasily Averin

Objects can be created from memcg-limited tasks
but its misuse may lead to host OOM.

---
 net/ipv6/ip6_fib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_fib.c +0 -0
index ef9d022..fa92ed1 100644

net/ipv6/ip6_fib.c int __init fib6_init(void) · line 2446

Quoted 2 lines
net/ipv6/ip6_fib.c +0 -0
@@ -2445,7 +2445,7 @@ int __init fib6_init(void)
 
        fib6_node_kmem = kmem_cache_create("fib6_nodes",

Can you talk a bit more about the lifetime of the object created from this kmem cache? Also who and what operation can trigger allocation?

Similarly can you add this information to the remaining patches of your series as well?

Quoted 9 lines
net/ipv6/ip6_fib.c +1 -2
                                           sizeof(struct fib6_node),
-                                          0, SLAB_HWCACHE_ALIGN,
+                                          0, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
                                           NULL);
        if (!fib6_node_kmem)
                goto out;
--

1.8.3.1

#2 lore raw
Quoted 16 lines · Shakeel Butt
Quoted 15 lines · Vasily Averin

Objects can be created from memcg-limited tasks
but its misuse may lead to host OOM.

---
 net/ipv6/ip6_fib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_fib.c +0 -0
index ef9d022..fa92ed1 100644
@@ -2445,7 +2445,7 @@ int __init fib6_init(void)
 
Quoted 4 lines

net/ipv6/ip6_fib.c int __init fib6_init(void) · line 2446

Quoted 1 line
net/ipv6/ip6_fib.c +0 -0
        fib6_node_kmem = kmem_cache_create("fib6_nodes",

Can you talk a bit more about the lifetime of the object created from this kmem cache? Also who and what operation can trigger allocation?

The lifetime is less of a concern since we have a slab reparenting mechanism, unless it's a very short-living object.