[Devel] [PATCH rh7 1/3] tcache: do not account kmem allocations to memcg

Vladimir Davydov vdavydov at parallels.com
Mon Jul 27 08:49:49 PDT 2015


Currently, we account radix-tree nodes used for linking tcache pages to
memcg/kmem, because every kmem allocation is accounted to the current
memcg unless it is marked as __GFP_NOACCOUNT. As a result, as tcache
gets filled by a container, the container's memory usage will grow too
due to the above-mentioned radix-tree nodes. It might even kill the
container if there is enough free memory on the host.

Since these radix-tree nodes belong to the host, as well as tcache
pages, and are evicted only on global memory pressure, we shouldn't
account them to memcg.

https://jira.sw.ru/browse/PSBM-35205

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/tcache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/tcache.c b/mm/tcache.c
index b078c84f9564..2d8291f06948 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -311,12 +311,12 @@ static struct tcache_node *tcache_alloc_node(void)
 {
 	struct tcache_node *node;
 
-	node = kzalloc(sizeof(*node), TCACHE_GFP_MASK);
+	node = kzalloc(sizeof(*node), TCACHE_GFP_MASK | __GFP_NOACCOUNT);
 	if (!node)
 		return NULL;
 
 	kref_init(&node->kref);
-	INIT_RADIX_TREE(&node->page_tree, TCACHE_GFP_MASK);
+	INIT_RADIX_TREE(&node->page_tree, TCACHE_GFP_MASK | __GFP_NOACCOUNT);
 	spin_lock_init(&node->tree_lock);
 
 	return node;
-- 
2.1.4




More information about the Devel mailing list