[Devel] [PATCH RHEL7 COMMIT] ub: reset UB_OOMGUARPAGES.held on css free

Konstantin Khorenko khorenko at virtuozzo.com
Thu May 28 09:09:50 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.7
------>
commit a0814a0dae0796352ac2fec1d22e71051e76ce03
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Thu May 28 20:09:50 2015 +0400

    ub: reset UB_OOMGUARPAGES.held on css free
    
    Patchset description:
    
    This patch set adds memory.oom_guarantee file to memory cgroup which
    allows to protect a memory cgroup from OOM killer. It works as follows:
    OOM killer first selects from processes in cgroups that are above their
    OOM guarantee, and only if there is no such it switches to scanning
    processes from all cgroups. This behavior is similar to UB_OOMGUARPAGES.
    
    It also adds OOM kills counter to each memory cgroup and synchronizes
    beancounters' UB_OOMGUARPAGES resource with oom_guarantee/oom_kill_cnt
    obtained from mem_cgroup.
    
    Related to https://jira.sw.ru/browse/PSBM-20089
    
    Vladimir Davydov (3):
      memcg: add oom_guarantee
      memcg: count oom kills
      memcg: sync UB_OOMGUARPAGES
    
    This patch description:
    
    This resource is now accounted by memcg, so it may be non-zero on
    beancounter removal, which will result in a warning:
    
      Ub 101 helds 467137 in oomguarpages on put
      UB: leaked beancounter 101 (ffff8801083a0000)
    
    Reset this resource on css free, just like we reset UB_PHYSPAGES,
    UB_SWAPPAGES, and UB_KMEMSIZE.
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 kernel/bc/beancounter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 0ef99f0..30762f5 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -395,6 +395,7 @@ static inline int bc_verify_held(struct user_beancounter *ub)
 	ub->ub_parms[UB_DCACHESIZE].held = 0;
 	ub->ub_parms[UB_PHYSPAGES].held = 0;
 	ub->ub_parms[UB_SWAPPAGES].held = 0;
+	ub->ub_parms[UB_OOMGUARPAGES].held = 0;
 
 	clean = 1;
 	for (i = 0; i < UB_RESOURCES; i++)



More information about the Devel mailing list