Skip to content

Commit 4358997

Browse files
rientjestorvalds
authored andcommitted
oom: avoid sending exiting tasks a SIGKILL
It's unnecessary to SIGKILL a task that is already PF_EXITING and can actually cause a NULL pointer dereference of the sighand if it has already been detached. Instead, simply set TIF_MEMDIE so it has access to memory reserves and can quickly exit as the comment implies. Reviewed-by: KAMEZAWA Hiroyuki <[email protected]> Signed-off-by: David Rientjes <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7b98c2e commit 4358997

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/oom_kill.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
453453
* its children or threads, just set TIF_MEMDIE so it can die quickly
454454
*/
455455
if (p->flags & PF_EXITING) {
456-
__oom_kill_task(p, 0);
456+
set_tsk_thread_flag(p, TIF_MEMDIE);
457457
return 0;
458458
}
459459

0 commit comments

Comments
 (0)