Skip to contentSkip to conversation

mm: oom: do not reap task if there are live threads in threadgroup

PATCH Applied Vladimir Davydov 2 participants 3 messages May 24, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: oom: do not reap task if there are live threads in threadgroup

If the current process is exiting, we don't invoke oom killer, instead we give it access to memory reserves and try to reap its mm in case nobody is going to use it. There's a mistake in the code performing this check - we just ignore any process of the same thread group no matter if it is exiting or not - see try_oom_reaper. Fix it.

---
 mm/oom_kill.c | 2 --
 1 file changed, 2 deletions(-)
mm/oom_kill.c +0 -2
index c0e37dd1422f..03bf7a472296 100644
@@ -618,8 +618,6 @@ void try_oom_reaper(struct task_struct *tsk)
 
 			if (!process_shares_mm(p, mm))
 				continue;
-			if (same_thread_group(p, tsk))
-				continue;
 			if (fatal_signal_pending(p))
 				continue;
 
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Vladimir Davydov

If the current process is exiting, we don't invoke oom killer, instead we give it access to memory reserves and try to reap its mm in case nobody is going to use it. There's a mistake in the code performing this check - we just ignore any process of the same thread group no matter if it is exiting or not - see try_oom_reaper. Fix it.

This is not a problem with the current code because of 98748bd72200 ("oom: consider multi-threaded tasks in task_will_free_mem") which got merged later on, however.

The check is not needed so we can indeed drop it.

Fixes 3ef22dfff239 ("oom, oom_reaper: try to reap tasks which skip

regular OOM killer path")

Just in case somebody wants to backport only 3ef22dfff239.

Quoted 1 line

Thanks!

Quoted 19 lines
---
 mm/oom_kill.c | 2 --
 1 file changed, 2 deletions(-)
mm/oom_kill.c +0 -2
index c0e37dd1422f..03bf7a472296 100644
@@ -618,8 +618,6 @@ void try_oom_reaper(struct task_struct *tsk)
 
 			if (!process_shares_mm(p, mm))
 				continue;
-			if (same_thread_group(p, tsk))
-				continue;
 			if (fatal_signal_pending(p))
 				continue;
 
Signature · 1 line
2.1.4
Signature · 8 lines
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw
Quoted 10 lines · Michal Hocko
Quoted 5 lines · Vladimir Davydov

If the current process is exiting, we don't invoke oom killer, instead we give it access to memory reserves and try to reap its mm in case nobody is going to use it. There's a mistake in the code performing this check - we just ignore any process of the same thread group no matter if it is exiting or not - see try_oom_reaper. Fix it.

This is not a problem with the current code because of 98748bd72200 ("oom: consider multi-threaded tasks in task_will_free_mem") which got merged later on, however.

True, I missed that patch.

Quoted 11 lines

The check is not needed so we can indeed drop it.

Fixes 3ef22dfff239 ("oom, oom_reaper: try to reap tasks which skip

regular OOM killer path")

Just in case somebody wants to backport only 3ef22dfff239.

Quoted 1 line

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>