lkml.org 
[lkml]   [2016]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm
From
Date
Michal Hocko wrote:
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 5bb2f7698ad7..0e33e912f7e4 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -820,6 +820,13 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
> task_unlock(victim);
>
> /*
> + * skip expensive iterations over all tasks if we know that there
> + * are no users outside of threads in the same thread group
> + */
> + if (atomic_read(&mm->mm_users) <= get_nr_threads(victim))
> + goto oom_reap;

Is this really safe? Isn't it possible that victim thread's thread group has
more than atomic_read(&mm->mm_users) threads which are past exit_mm() and blocked
at exit_task_work() which are before __exit_signal() from release_task() from
exit_notify()?

> +
> + /*
> * Kill all user processes sharing victim->mm in other thread groups, if
> * any. They don't get access to memory reserves, though, to avoid
> * depletion of all memory. This prevents mm->mmap_sem livelock when an

\
 
 \ /
  Last update: 2016-05-26 17:01    [W:0.428 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site