aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nishimura <[email protected]>2011-07-26 16:08:25 -0700
committerLinus Torvalds <[email protected]>2011-07-26 16:49:42 -0700
commit108b6a78463bb8c7163e4f9779f36ad8bbade334 (patch)
treef23a3d4835cf61ba73b918169355bafbf20e3966
parent4508378b9523e22a2a0175d8bf64d932fb10a67d (diff)
memcg: fix behavior of mem_cgroup_resize_limit()
Commit 22a668d7c3ef ("memcg: fix behavior under memory.limit equals to memsw.limit") introduced "memsw_is_minimum" flag, which becomes true when mem_limit == memsw_limit. The flag is checked at the beginning of reclaim, and "noswap" is set if the flag is true, because using swap is meaningless in this case. This works well in most cases, but when we try to shrink mem_limit, which is the same as memsw_limit now, we might fail to shrink mem_limit because swap doesn't used. This patch fixes this behavior by: - check MEM_CGROUP_RECLAIM_SHRINK at the begining of reclaim - If it is set, don't set "noswap" flag even if memsw_is_minimum is true. Signed-off-by: Daisuke Nishimura <[email protected]> Cc: Balbir Singh <[email protected]> Acked-by: KAMEZAWA Hiroyuki <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Ying Han <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/memcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c0b065ec1571..dfeca594fd7a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1653,7 +1653,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
excess = res_counter_soft_limit_excess(&root_mem->res) >> PAGE_SHIFT;
/* If memsw_is_minimum==1, swap-out is of-no-use. */
- if (!check_soft && root_mem->memsw_is_minimum)
+ if (!check_soft && !shrink && root_mem->memsw_is_minimum)
noswap = true;
while (1) {