Skip to content

Commit cbdcf7f

Browse files
Michal Hockotorvalds
authored andcommitted
mm, oom_reaper: do not use siglock in try_oom_reaper()
Oleg has noted that siglock usage in try_oom_reaper is both pointless and dangerous. signal_group_exit can be checked lockless. The problem is that sighand becomes NULL in __exit_signal so we can crash. Fixes: 3ef22df ("oom, oom_reaper: try to reap tasks which skip regular OOM killer path") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Michal Hocko <[email protected]> Suggested-by: Oleg Nesterov <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 83b9355 commit cbdcf7f

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

mm/oom_kill.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,6 @@ void try_oom_reaper(struct task_struct *tsk)
625625
if (atomic_read(&mm->mm_users) > 1) {
626626
rcu_read_lock();
627627
for_each_process(p) {
628-
bool exiting;
629-
630628
if (!process_shares_mm(p, mm))
631629
continue;
632630
if (fatal_signal_pending(p))
@@ -636,10 +634,7 @@ void try_oom_reaper(struct task_struct *tsk)
636634
* If the task is exiting make sure the whole thread group
637635
* is exiting and cannot acces mm anymore.
638636
*/
639-
spin_lock_irq(&p->sighand->siglock);
640-
exiting = signal_group_exit(p->signal);
641-
spin_unlock_irq(&p->sighand->siglock);
642-
if (exiting)
637+
if (signal_group_exit(p->signal))
643638
continue;
644639

645640
/* Give up */

0 commit comments

Comments
 (0)