Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Johannes Weiner and committed by
Linus Torvalds
b7c61678 56039efa

+3 -3
+2 -2
include/linux/res_counter.h
··· 139 139 140 140 static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt) 141 141 { 142 - if (cnt->usage < cnt->soft_limit) 142 + if (cnt->usage <= cnt->soft_limit) 143 143 return true; 144 144 145 145 return false; ··· 202 202 return ret; 203 203 } 204 204 205 - static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt) 205 + static inline bool res_counter_check_within_soft_limit(struct res_counter *cnt) 206 206 { 207 207 bool ret; 208 208 unsigned long flags;
+1 -1
mm/memcontrol.c
··· 1477 1477 return ret; 1478 1478 total += ret; 1479 1479 if (check_soft) { 1480 - if (res_counter_check_under_soft_limit(&root_mem->res)) 1480 + if (res_counter_check_within_soft_limit(&root_mem->res)) 1481 1481 return total; 1482 1482 } else if (mem_cgroup_check_under_limit(root_mem)) 1483 1483 return 1 + total;