Skip to content

Commit b522794

Browse files
oleg-nesterovtorvalds
authored andcommitted
oom: PF_EXITING check should take mm into account
select_bad_process() checks PF_EXITING to detect the task which is going to release its memory, but the logic is very wrong. - a single process P with the dead group leader disables select_bad_process() completely, it will always return ERR_PTR() while P can live forever - if the PF_EXITING task has already released its ->mm it doesn't make sense to expect it is goiing to free more memory (except task_struct/etc) Change the code to ignore the PF_EXITING tasks without ->mm. Signed-off-by: Oleg Nesterov <[email protected]> Signed-off-by: David Rientjes <[email protected]> Cc: Balbir Singh <[email protected]> Acked-by: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 455c0e5 commit b522794

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
@@ -287,7 +287,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
287287
* the process of exiting and releasing its resources.
288288
* Otherwise we could get an easy OOM deadlock.
289289
*/
290-
if (p->flags & PF_EXITING) {
290+
if ((p->flags & PF_EXITING) && p->mm) {
291291
if (p != current)
292292
return ERR_PTR(-1UL);
293293

0 commit comments

Comments
 (0)