Skip to content

Commit

Permalink
mm: Don't warn on page allocation failures for OOM-killed processes
Browse files Browse the repository at this point in the history
It can be normal for a dying process to have its page allocation request
fail when it has an OOM or LMK kill pending. In this case, it's actually
detrimental to print out a massive allocation failure message because
this means the running process needs to die quickly and release its
memory, which is slowed down slightly by the massive kmsg splat. The
allocation failure message is also a false positive in this case, since
the failure is intentional rather than being the result of an inability
to allocate memory.

Suppress the allocation failure warning for processes that are killed to
release memory in order to expedite their death and remedy the kmsg
confusion from seeing spurious allocation failure messages.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
  • Loading branch information
kerneltoast authored and kdrag0n committed Aug 25, 2020
1 parent a4d2a40 commit ed23ad4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4194,8 +4194,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
/* Avoid allocations with no watermarks from looping endlessly */
if (tsk_is_oom_victim(current) &&
(alloc_flags == ALLOC_OOM ||
(gfp_mask & __GFP_NOMEMALLOC)))
(gfp_mask & __GFP_NOMEMALLOC))) {
gfp_mask |= __GFP_NOWARN;
goto nopage;
}

/* Retry as long as the OOM killer is making progress */
if (did_some_progress) {
Expand Down

0 comments on commit ed23ad4

Please sign in to comment.