[Devel] [PATCH RHEL7 COMMIT] memcg/bc: sync UB_DCACHESIZE
Konstantin Khorenko
khorenko at virtuozzo.com
Thu May 28 04:07:25 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 bdf93bb87ff5294f8d056e941b93c1e5abfa210f
Author: Vladimir Davydov <vdavydov at parallels.com>
Date: Thu May 28 15:07:24 2015 +0400
memcg/bc: sync UB_DCACHESIZE
Sync it with mem_cgroup->dcache. Disallow setting the limit, because we
do not support it, and issue a warning if the user tries to set it via
the legacy UB interface, just like we do in case with UB_KMEMSIZE.
Related to https://jira.sw.ru/browse/PSBM-20089
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
Reviewed-by: Cyrill Gorcunov <gorcunov at odin.com>
---
kernel/bc/beancounter.c | 3 ++-
kernel/bc/vm_pages.c | 1 -
mm/memcontrol.c | 10 +++++++++-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index f08402e..bffdf0a 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -424,6 +424,7 @@ static inline int bc_verify_held(struct user_beancounter *ub)
/* accounted by memcg */
ub->ub_parms[UB_KMEMSIZE].held = 0;
+ ub->ub_parms[UB_DCACHESIZE].held = 0;
ub->ub_parms[UB_PHYSPAGES].held = 0;
ub->ub_parms[UB_SWAPPAGES].held = 0;
@@ -943,7 +944,7 @@ static void init_beancounter_syslimits(struct user_beancounter *ub)
ub->ub_parms[UB_NUMFLOCK].limit = 1024;
ub->ub_parms[UB_NUMPTY].limit = 16;
ub->ub_parms[UB_NUMSIGINFO].limit = 1024;
- ub->ub_parms[UB_DCACHESIZE].limit = 1024*1024;
+ ub->ub_parms[UB_DCACHESIZE].limit = UB_MAXVALUE;
ub->ub_parms[UB_NUMFILE].limit = 1024;
ub->ub_parms[UB_PHYSPAGES].limit = UB_MAXVALUE;
ub->ub_parms[UB_SWAPPAGES].limit = UB_MAXVALUE;
diff --git a/kernel/bc/vm_pages.c b/kernel/bc/vm_pages.c
index e0e3c45..a6f311e 100644
--- a/kernel/bc/vm_pages.c
+++ b/kernel/bc/vm_pages.c
@@ -202,7 +202,6 @@ static int bc_fill_meminfo(struct user_beancounter *ub,
mi->dirty_pages += pcpu->dirty_pages;
mi->writeback_pages += pcpu->writeback_pages;
- dcache -= pcpu->precharge[UB_DCACHESIZE];
}
mi->dirty_pages = max_t(long, 0, mi->dirty_pages);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0a8f816..bfc081c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5193,9 +5193,10 @@ void mem_cgroup_sync_beancounter(struct cgroup *cg, struct user_beancounter *ub)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cg);
unsigned long long lim, held, maxheld;
- volatile struct ubparm *k, *p, *s;
+ volatile struct ubparm *k, *d, *p, *s;
k = &ub->ub_parms[UB_KMEMSIZE];
+ d = &ub->ub_parms[UB_DCACHESIZE];
p = &ub->ub_parms[UB_PHYSPAGES];
s = &ub->ub_parms[UB_SWAPPAGES];
@@ -5215,6 +5216,11 @@ void mem_cgroup_sync_beancounter(struct cgroup *cg, struct user_beancounter *ub)
min_t(unsigned long long, lim, UB_MAXVALUE);
k->barrier = k->limit = lim;
+ d->held = res_counter_read_u64(&memcg->dcache, RES_USAGE);
+ d->maxheld = res_counter_read_u64(&memcg->dcache, RES_MAX_USAGE);
+ d->failcnt = 0;
+ d->barrier = d->limit = UB_MAXVALUE;
+
held = (res_counter_read_u64(&memcg->memsw, RES_USAGE) -
res_counter_read_u64(&memcg->res, RES_USAGE)) >> PAGE_SHIFT;
maxheld = memcg->swap_max >> PAGE_SHIFT;
@@ -5256,6 +5262,8 @@ int mem_cgroup_apply_beancounter(struct cgroup *cg, struct user_beancounter *ub)
if (ub->ub_parms[UB_KMEMSIZE].limit != UB_MAXVALUE)
pr_warn_once("ub: kmemsize limit is deprecated\n");
+ if (ub->ub_parms[UB_DCACHESIZE].limit != UB_MAXVALUE)
+ pr_warn_once("ub: dcachesize limit is deprecated\n");
/* activate kmem accounting */
ret = memcg_update_kmem_limit(memcg, RESOURCE_MAX);
More information about the Devel
mailing list