Commit aa68a626 authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by James Toy

SoftLimit tree 'find next one' loop uses next_mz to remember next one to

be visited if reclaimd==0.

But css'refcnt handling for next_mz is not enough and it makes css->refcnt
leak.
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: default avatarDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 050627ed
...@@ -2226,6 +2226,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, ...@@ -2226,6 +2226,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
if (!reclaimed) { if (!reclaimed) {
do { do {
/* /*
* Loop until we find yet another one.
*
* By the time we get the soft_limit lock * By the time we get the soft_limit lock
* again, someone might have aded the * again, someone might have aded the
* group back on the RB tree. Iterate to * group back on the RB tree. Iterate to
...@@ -2236,7 +2238,12 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, ...@@ -2236,7 +2238,12 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
*/ */
next_mz = next_mz =
__mem_cgroup_largest_soft_limit_node(mctz); __mem_cgroup_largest_soft_limit_node(mctz);
} while (next_mz == mz); if (next_mz == mz) {
css_put(&next_mz->mem->css);
next_mz = NULL;
} else /* next_mz == NULL or other memcg */
break;
} while (1);
} }
mz->usage_in_excess = mz->usage_in_excess =
res_counter_soft_limit_excess(&mz->mem->res); res_counter_soft_limit_excess(&mz->mem->res);
...@@ -2264,6 +2271,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, ...@@ -2264,6 +2271,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
loop > MEM_CGROUP_MAX_SOFT_LIMIT_RECLAIM_LOOPS)) loop > MEM_CGROUP_MAX_SOFT_LIMIT_RECLAIM_LOOPS))
break; break;
} while (!nr_reclaimed); } while (!nr_reclaimed);
if (next_mz)
css_put(&next_mz->mem->css);
return nr_reclaimed; return nr_reclaimed;
} }
......
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