aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2012-03-28 17:42:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 20:14:35 -0400
commit29fd66d289f2981e11c550f8b411a6d3d38be0cf (patch)
treecc9931d0ee891ccfe9114bfd977da47f47175dbe /mm/page_alloc.c
parent45f83cefe3a5f0476ac3f96382ebfdc3fe4caab2 (diff)
mm, coredump: fail allocations when coredumping instead of oom killing
The size of coredump files is limited by RLIMIT_CORE, however, allocating large amounts of memory results in three negative consequences: - the coredumping process may be chosen for oom kill and quickly deplete all memory reserves in oom conditions preventing further progress from being made or tasks from exiting, - the coredumping process may cause other processes to be oom killed without fault of their own as the result of a SIGSEGV, for example, in the coredumping process, or - the coredumping process may result in a livelock while writing to the dump file if it needs memory to allocate while other threads are in the exit path waiting on the coredumper to complete. This is fixed by implying __GFP_NORETRY in the page allocator for coredumping processes when reclaim has failed so the allocations fail and the process continues to exit. Signed-off-by: David Rientjes <rientjes@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index caea788628e4..c313afcc8e5a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2308,6 +2308,10 @@ rebalance:
2308 if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) { 2308 if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) {
2309 if (oom_killer_disabled) 2309 if (oom_killer_disabled)
2310 goto nopage; 2310 goto nopage;
2311 /* Coredumps can quickly deplete all memory reserves */
2312 if ((current->flags & PF_DUMPCORE) &&
2313 !(gfp_mask & __GFP_NOFAIL))
2314 goto nopage;
2311 page = __alloc_pages_may_oom(gfp_mask, order, 2315 page = __alloc_pages_may_oom(gfp_mask, order,
2312 zonelist, high_zoneidx, 2316 zonelist, high_zoneidx,
2313 nodemask, preferred_zone, 2317 nodemask, preferred_zone,