[PATCH 2/2] memcg: fix reclaim result checks.

From: KAMEZAWA Hiroyuki
Date: Fri Nov 21 2008 - 05:04:46 EST


check_under_limit logic was wrong and this check should be against
mem_over_limit rather than mem.

Reported-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
---
mm/memcontrol.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

Index: mmotm-2.6.28-Nov20/mm/memcontrol.c
===================================================================
--- mmotm-2.6.28-Nov20.orig/mm/memcontrol.c
+++ mmotm-2.6.28-Nov20/mm/memcontrol.c
@@ -714,17 +714,17 @@ static int __mem_cgroup_try_charge(struc
* current usage of the cgroup before giving up
*
*/
- if (!do_swap_account &&
- res_counter_check_under_limit(&mem->res))
- continue;
- if (do_swap_account &&
- res_counter_check_under_limit(&mem->memsw))
- continue;
+ if (do_swap_account) {
+ if (res_counter_check_under_limit(&mem_over_limit->res) &&
+ res_counter_check_under_limit(&mem_over_limit->memsw))
+ continue;
+ } else if (res_counter_check_under_limit(&mem_over_limit->res))
+ continue;

if (!nr_retries--) {
if (oom) {
- mem_cgroup_out_of_memory(mem, gfp_mask);
- mem->last_oom_jiffies = jiffies;
+ mem_cgroup_out_of_memory(mem_over_limit, gfp_mask);
+ mem_over_limit->last_oom_jiffies = jiffies;
}
goto nomem;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/