[Devel] [PATCH rh7 4/4] ub: deprecate kmemsize limit
Vladimir Davydov
vdavydov at parallels.com
Tue May 19 07:31:48 PDT 2015
Setting kmemsize limit < physpages limit is useless, because hitting
kmemsize limit does not trigger reclaim. This is upstream behavior and
we are not going to fix it for now, because kmemsize is accounted to and
limited by physpages anyway.
This patch makes the kernel ignore kmemsize limit, issuing a warning on
an attempt to set it.
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
kernel/bc/beancounter.c | 4 +---
mm/memcontrol.c | 16 +++++++---------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 88faa1c508a5..8cbf7d4b7192 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -986,9 +986,7 @@ static void init_beancounter_syslimits(struct user_beancounter *ub)
int k;
mp = num_physpages;
- ub->ub_parms[UB_KMEMSIZE].limit =
- mp > (192*1024*1024 >> PAGE_SHIFT) ?
- 32*1024*1024 : (mp << PAGE_SHIFT) / 6;
+ ub->ub_parms[UB_KMEMSIZE].limit = UB_MAXVALUE;
ub->ub_parms[UB_LOCKEDPAGES].limit = 8;
ub->ub_parms[UB_PRIVVMPAGES].limit = UB_MAXVALUE;
ub->ub_parms[UB_SHMPAGES].limit = 64;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ba6fc0f641cf..01a8e5a5cfd5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5194,7 +5194,7 @@ void mem_cgroup_fill_ub_parms(struct cgroup *cg,
int mem_cgroup_apply_beancounter(struct cgroup *cg, struct user_beancounter *ub)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cg);
- unsigned long long mem, memsw, kmem, mem_old, memsw_old;
+ unsigned long long mem, memsw, mem_old, memsw_old;
int ret = 0;
mem = ub->ub_parms[UB_PHYSPAGES].limit;
@@ -5213,15 +5213,13 @@ int mem_cgroup_apply_beancounter(struct cgroup *cg, struct user_beancounter *ub)
else
memsw = RESOURCE_MAX;
- kmem = ub->ub_parms[UB_KMEMSIZE].limit;
- if (kmem >= RESOURCE_MAX)
- kmem = RESOURCE_MAX - 1; /* not 'unlimited' */
+ if (ub->ub_parms[UB_KMEMSIZE].limit != UB_MAXVALUE)
+ pr_warn_once("ub: kmemsize limit is deprecated\n");
- if (res_counter_read_u64(&memcg->kmem, RES_LIMIT) != kmem) {
- ret = memcg_update_kmem_limit(memcg, kmem);
- if (ret)
- goto out;
- }
+ /* activate kmem accounting */
+ ret = memcg_update_kmem_limit(memcg, RESOURCE_MAX);
+ if (ret)
+ goto out;
/* try change mem+swap before changing mem limit */
if (res_counter_read_u64(&memcg->memsw, RES_LIMIT) != memsw)
--
1.7.10.4
More information about the Devel
mailing list