Skip to content

Commit

Permalink
memcg: soft limit reclaim should end at limit not below
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Daisuke Nishimura <[email protected]>
Acked-by: Balbir Singh <[email protected]>
Cc: Minchan Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hnaz authored and torvalds committed Mar 24, 2011
1 parent 56039ef commit b7c6167
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/linux/res_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
if (cnt->usage < cnt->soft_limit)
if (cnt->usage <= cnt->soft_limit)
return true;

return false;
Expand Down Expand Up @@ -202,7 +202,7 @@ static inline bool res_counter_check_margin(struct res_counter *cnt,
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;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
return ret;
total += ret;
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;
} else if (mem_cgroup_check_under_limit(root_mem))
return 1 + total;
Expand Down

0 comments on commit b7c6167

Please sign in to comment.