[Devel] [PATCH RHEL7 COMMIT] Revert "ve/radix-tree: do not account radix_tree_nodes to memcg"

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 2 07:05:58 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.16
------>
commit 844adb16c68ee8a98689511e807574aca06d474c
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Mon May 2 18:05:58 2016 +0400

    Revert "ve/radix-tree: do not account radix_tree_nodes to memcg"
    
    Patchset description:
    kmemcg: switch to whitelist policy
    
    Currently, all kmalloc/vmalloc allocations are accounted by default. To
    exclude a particular allocation site, one need to pass __GFP_NOACCOUNT.
    Such a policy turns out to be fragile, because there are tons of kmem
    allocations that are intentionally shared among different cgroups. It'd
    be tedious to try to identify them all and mark as __GFP_NOACCOUNT, so
    let's instead switch to the whitelist policy, i.e. to charge kmalloc to
    memcg one needs to explicitly pass __GFP_ACCOUNT. This is how it works
    both in PCS6 and upstream BTW.
    
    Patches 1-5 revert changes regarding the blacklist policy. Patches 6-8
    are ported from mainstream. They introduce __GFP_ACCOUNT and
    SLAB_ACCOUNT flags and mark those allocations that should obviously be
    accounted as such. In addition, patch 9 marks all allocations that we
    account in PCS6.
    
    https://jira.sw.ru/browse/PSBM-45975
    
    Vladimir Davydov (9):
      Revert "ve/radix-tree: do not account radix_tree_nodes to memcg"
      Revert "mm/vmalloc: do not account vmap_area to memcg"
      Partially revert "tcp: Charge socket buffers into cg memory"
      Revert "ms/sysfs: do not account sysfs_ino_ida allocations to memcg"
      Revert "ms/gfp: add __GFP_NOACCOUNT"
      memcg: only account kmem allocations marked as __GFP_ACCOUNT
      slab: add SLAB_ACCOUNT flag
      kmemcg: account certain kmem allocations to memcg
      Charge kmem allocations accounted to UBC in PCS6 to memcg
    
    ================================================
    This patch description:
    
    This reverts commit b635e5ee4f93554e2af7feb08866e67df10f3940.
    
    We are going to switch to the whitelist kmem accounting policy, so zap
    every usage of __GFP_NOACCOUNT.
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 lib/radix-tree.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 4b362cb..dd3347f 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -228,8 +228,7 @@ radix_tree_node_alloc(struct radix_tree_root *root)
 		}
 	}
 	if (ret == NULL)
-		ret = kmem_cache_alloc(radix_tree_node_cachep,
-				       gfp_mask | __GFP_NOACCOUNT);
+		ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
 
 	BUG_ON(radix_tree_is_indirect_ptr(ret));
 	return ret;
@@ -280,8 +279,7 @@ static int __radix_tree_preload(gfp_t gfp_mask)
 	rtp = &__get_cpu_var(radix_tree_preloads);
 	while (rtp->nr < ARRAY_SIZE(rtp->nodes)) {
 		preempt_enable();
-		node = kmem_cache_alloc(radix_tree_node_cachep,
-					gfp_mask | __GFP_NOACCOUNT);
+		node = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask);
 		if (node == NULL)
 			goto out;
 		preempt_disable();


More information about the Devel mailing list