aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2011-02-01 18:52:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-02 19:03:19 -0500
commit8493ae439f7038b502df1d687e61dde54c27ca92 (patch)
treeba8dafa7eb3292c8d2ca4597ef6f2f06c7dcd6a6 /mm/memcontrol.c
parent19942822df65ee4a47c2e6d6d70cace1b7f01710 (diff)
memcg: never OOM when charging huge pages
Huge page coverage should obviously have less priority than the continued execution of a process. Never kill a process when charging it a huge page fails. Instead, give up after the first failed reclaim attempt and fall back to regular pages. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0e81eb5f0aea..fc75f34ba609 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2351,13 +2351,19 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
2351 gfp_t gfp_mask, enum charge_type ctype) 2351 gfp_t gfp_mask, enum charge_type ctype)
2352{ 2352{
2353 struct mem_cgroup *mem = NULL; 2353 struct mem_cgroup *mem = NULL;
2354 int page_size = PAGE_SIZE;
2354 struct page_cgroup *pc; 2355 struct page_cgroup *pc;
2356 bool oom = true;
2355 int ret; 2357 int ret;
2356 int page_size = PAGE_SIZE;
2357 2358
2358 if (PageTransHuge(page)) { 2359 if (PageTransHuge(page)) {
2359 page_size <<= compound_order(page); 2360 page_size <<= compound_order(page);
2360 VM_BUG_ON(!PageTransHuge(page)); 2361 VM_BUG_ON(!PageTransHuge(page));
2362 /*
2363 * Never OOM-kill a process for a huge page. The
2364 * fault handler will fall back to regular pages.
2365 */
2366 oom = false;
2361 } 2367 }
2362 2368
2363 pc = lookup_page_cgroup(page); 2369 pc = lookup_page_cgroup(page);
@@ -2366,7 +2372,7 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
2366 return 0; 2372 return 0;
2367 prefetchw(pc); 2373 prefetchw(pc);
2368 2374
2369 ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true, page_size); 2375 ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, oom, page_size);
2370 if (ret || !mem) 2376 if (ret || !mem)
2371 return ret; 2377 return ret;
2372 2378