Skip to content
  • David Rientjes's avatar
    mm, coredump: fail allocations when coredumping instead of oom killing · 29fd66d2
    David Rientjes authored
    
    
    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: default avatarDavid 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    29fd66d2