Skip to content

Commit 8447d95

Browse files
rientjestorvalds
authored andcommitted
mm, oom: do not emit oom killer warning if chosen thread is already exiting
If a thread is chosen for oom kill and is already PF_EXITING, then the oom killer simply sets TIF_MEMDIE and returns. This allows the thread to have access to memory reserves so that it may quickly exit. This logic is preceeded with a comment saying there's no need to alarm the sysadmin. This patch adds truth to that statement. There's no need to emit any warning about the oom condition if the thread is already exiting since it will not be killed. In this condition, just silently return the oom killer since its only giving access to memory reserves and is otherwise a no-op. Acked-by: KOSAKI Motohiro <[email protected]> Acked-by: KAMEZAWA Hiroyuki <[email protected]> Signed-off-by: David Rientjes <[email protected]> Acked-by: Michal Hocko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 647f2bd commit 8447d95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/oom_kill.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,6 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
445445
struct mm_struct *mm;
446446
unsigned int victim_points = 0;
447447

448-
if (printk_ratelimit())
449-
dump_header(p, gfp_mask, order, memcg, nodemask);
450-
451448
/*
452449
* If the task is already exiting, don't alarm the sysadmin or kill
453450
* its children or threads, just set TIF_MEMDIE so it can die quickly
@@ -457,6 +454,9 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
457454
return;
458455
}
459456

457+
if (printk_ratelimit())
458+
dump_header(p, gfp_mask, order, memcg, nodemask);
459+
460460
task_lock(p);
461461
pr_err("%s: Kill process %d (%s) score %d or sacrifice child\n",
462462
message, task_pid_nr(p), p->comm, points);

0 commit comments

Comments
 (0)