Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1407583

Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm
Date 2016-05-26 16:40 +0200
Message-ID <rD4C5-7At-9@gated-at.bofh.it> (permalink)
References <rD2TD-6uy-5@gated-at.bofh.it> <rD2TE-6uy-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Handle oom bypass more gracefully Michal Hocko <mhocko@kernel.org> - 2016-05-26 14:50 +0200
  [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj Michal Hocko <mhocko@kernel.org> - 2016-05-26 14:50 +0200
    Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Michal Hocko <mhocko@kernel.org> - 2016-05-27 13:20 +0200
      Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-27 18:20 +0200
        Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Michal Hocko <mhocko@kernel.org> - 2016-05-30 09:10 +0200
          Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-30 11:30 +0200
            Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Michal Hocko <mhocko@kernel.org> - 2016-05-30 11:50 +0200
              Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-30 12:50 +0200
                Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Michal Hocko <mhocko@kernel.org> - 2016-05-30 13:20 +0200
                Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-30 14:30 +0200
                Re: [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have  same view of oom_score_adj Michal Hocko <mhocko@kernel.org> - 2016-05-30 14:30 +0200
  [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm Michal Hocko <mhocko@kernel.org> - 2016-05-26 14:50 +0200
    Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-05-26 16:40 +0200
      Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no  external tasks sharing mm Michal Hocko <mhocko@kernel.org> - 2016-05-26 17:00 +0200
        Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are noexternal tasks sharing mm Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-05-26 17:30 +0200
          Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are  noexternal tasks sharing mm Michal Hocko <mhocko@kernel.org> - 2016-05-26 17:40 +0200
            Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-05-26 18:20 +0200
              Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no  external tasks sharing mm Michal Hocko <mhocko@kernel.org> - 2016-05-27 08:50 +0200
                Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no  external tasks sharing mm Michal Hocko <mhocko@kernel.org> - 2016-05-27 09:20 +0200
                Re: [PATCH 1/6] mm, oom: do not loop over all tasks if there are no  external tasks sharing mm Michal Hocko <mhocko@kernel.org> - 2016-05-27 10:10 +0200
  [PATCH 2/6] proc, oom_adj: extract oom_score_adj setting into a helper Michal Hocko <mhocko@kernel.org> - 2016-05-26 14:50 +0200
  Re: [PATCH 0/5] Handle oom bypass more gracefully Michal Hocko <mhocko@kernel.org> - 2016-05-27 18:10 +0200

csiph-web