Commit b7c61678 authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

memcg: soft limit reclaim should end at limit not below

Soft limit reclaim continues until the usage is below the current soft
limit, but the documented semantics are actually that soft limit reclaim
will push usage back until the soft limits are met again.
Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 56039efa
...@@ -139,7 +139,7 @@ static inline bool res_counter_limit_check_locked(struct res_counter *cnt) ...@@ -139,7 +139,7 @@ static inline bool res_counter_limit_check_locked(struct res_counter *cnt)
static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt) static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
{ {
if (cnt->usage < cnt->soft_limit) if (cnt->usage <= cnt->soft_limit)
return true; return true;
return false; return false;
...@@ -202,7 +202,7 @@ static inline bool res_counter_check_margin(struct res_counter *cnt, ...@@ -202,7 +202,7 @@ static inline bool res_counter_check_margin(struct res_counter *cnt,
return ret; return ret;
} }
static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt) static inline bool res_counter_check_within_soft_limit(struct res_counter *cnt)
{ {
bool ret; bool ret;
unsigned long flags; unsigned long flags;
......
...@@ -1477,7 +1477,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem, ...@@ -1477,7 +1477,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
return ret; return ret;
total += ret; total += ret;
if (check_soft) { if (check_soft) {
if (res_counter_check_under_soft_limit(&root_mem->res)) if (res_counter_check_within_soft_limit(&root_mem->res))
return total; return total;
} else if (mem_cgroup_check_under_limit(root_mem)) } else if (mem_cgroup_check_under_limit(root_mem))
return 1 + total; return 1 + total;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment