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


Groups > linux.kernel > #1423098 > unrolled thread

Re: [PATCH 09/10] mm, oom_reaper: do not attempt to reap a task more than twice

Started byOleg Nesterov <oleg@redhat.com>
First post2016-06-15 16:50 +0200
Last post2016-06-16 08:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 09/10] mm, oom_reaper: do not attempt to reap a task more  than twice Oleg Nesterov <oleg@redhat.com> - 2016-06-15 16:50 +0200
    Re: [PATCH 09/10] mm, oom_reaper: do not attempt to reap a task more  than twice Michal Hocko <mhocko@kernel.org> - 2016-06-16 08:30 +0200

#1423098 — Re: [PATCH 09/10] mm, oom_reaper: do not attempt to reap a task more than twice

FromOleg Nesterov <oleg@redhat.com>
Date2016-06-15 16:50 +0200
SubjectRe: [PATCH 09/10] mm, oom_reaper: do not attempt to reap a task more than twice
Message-ID<rKkiK-3Lp-9@gated-at.bofh.it>
On 06/09, Michal Hocko wrote:
>
> @@ -556,8 +556,27 @@ static void oom_reap_task(struct task_struct *tsk)
>  		schedule_timeout_idle(HZ/10);
>  
>  	if (attempts > MAX_OOM_REAP_RETRIES) {
> +		struct task_struct *p;
> +
>  		pr_info("oom_reaper: unable to reap pid:%d (%s)\n",
>  				task_pid_nr(tsk), tsk->comm);
> +
> +		/*
> +		 * If we've already tried to reap this task in the past and
> +		 * failed it probably doesn't make much sense to try yet again
> +		 * so hide the mm from the oom killer so that it can move on
> +		 * to another task with a different mm struct.
> +		 */
> +		p = find_lock_task_mm(tsk);
> +		if (p) {
> +			if (test_and_set_bit(MMF_OOM_NOT_REAPABLE, &p->mm->flags)) {
> +				pr_info("oom_reaper: giving up pid:%d (%s)\n",
> +						task_pid_nr(tsk), tsk->comm);
> +				set_bit(MMF_OOM_REAPED, &p->mm->flags);

But why do we need MMF_OOM_NOT_REAPABLE? We set MMF_OOM_REAPED, oom_reap_task()
should not see this task again, at least too often.

Oleg.

[toc] | [next] | [standalone]


#1423705

FromMichal Hocko <mhocko@kernel.org>
Date2016-06-16 08:30 +0200
Message-ID<rKyYu-4LB-21@gated-at.bofh.it>
In reply to#1423098
On Wed 15-06-16 16:48:35, Oleg Nesterov wrote:
> On 06/09, Michal Hocko wrote:
> >
> > @@ -556,8 +556,27 @@ static void oom_reap_task(struct task_struct *tsk)
> >  		schedule_timeout_idle(HZ/10);
> >  
> >  	if (attempts > MAX_OOM_REAP_RETRIES) {
> > +		struct task_struct *p;
> > +
> >  		pr_info("oom_reaper: unable to reap pid:%d (%s)\n",
> >  				task_pid_nr(tsk), tsk->comm);
> > +
> > +		/*
> > +		 * If we've already tried to reap this task in the past and
> > +		 * failed it probably doesn't make much sense to try yet again
> > +		 * so hide the mm from the oom killer so that it can move on
> > +		 * to another task with a different mm struct.
> > +		 */
> > +		p = find_lock_task_mm(tsk);
> > +		if (p) {
> > +			if (test_and_set_bit(MMF_OOM_NOT_REAPABLE, &p->mm->flags)) {
> > +				pr_info("oom_reaper: giving up pid:%d (%s)\n",
> > +						task_pid_nr(tsk), tsk->comm);
> > +				set_bit(MMF_OOM_REAPED, &p->mm->flags);
> 
> But why do we need MMF_OOM_NOT_REAPABLE? We set MMF_OOM_REAPED, oom_reap_task()
> should not see this task again, at least too often.

We set MMF_OOM_REAPED only when actually reaping something in
__oom_reap_task. We might have failed the mmap_sem read lock. The
purpose of this patch is to not encounter such a task for ever and do
not back off too easily. I guess we could set the flag unconditionally
after the first failure and can do that eventually when running out of
MMF flags but thiw way it looks like an easy trade off to me.

-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web