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


Groups > linux.kernel > #1423092 > unrolled thread

Re: [PATCH 10/10] mm, oom: hide mm which is shared with kthread or global init

Started byOleg Nesterov <oleg@redhat.com>
First post2016-06-15 16:40 +0200
Last post2016-06-16 08:40 +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 10/10] mm, oom: hide mm which is shared with kthread or  global init Oleg Nesterov <oleg@redhat.com> - 2016-06-15 16:40 +0200
    Re: [PATCH 10/10] mm, oom: hide mm which is shared with kthread or  global init Michal Hocko <mhocko@kernel.org> - 2016-06-16 08:40 +0200

#1423092 — Re: [PATCH 10/10] mm, oom: hide mm which is shared with kthread or global init

FromOleg Nesterov <oleg@redhat.com>
Date2016-06-15 16:40 +0200
SubjectRe: [PATCH 10/10] mm, oom: hide mm which is shared with kthread or global init
Message-ID<rKk94-3Hl-25@gated-at.bofh.it>
Michal,

I am going to ack the whole series, but send some nits/questions,

On 06/09, Michal Hocko wrote:
>
> @@ -283,10 +283,22 @@ enum oom_scan_t oom_scan_process_thread(struct oom_control *oc,
>  
>  	/*
>  	 * This task already has access to memory reserves and is being killed.
> -	 * Don't allow any other task to have access to the reserves.
> +	 * Don't allow any other task to have access to the reserves unless
> +	 * the task has MMF_OOM_REAPED because chances that it would release
> +	 * any memory is quite low.
>  	 */
> -	if (!is_sysrq_oom(oc) && atomic_read(&task->signal->oom_victims))
> -		return OOM_SCAN_ABORT;
> +	if (!is_sysrq_oom(oc) && atomic_read(&task->signal->oom_victims)) {
> +		struct task_struct *p = find_lock_task_mm(task);
> +		enum oom_scan_t ret = OOM_SCAN_ABORT;
> +
> +		if (p) {
> +			if (test_bit(MMF_OOM_REAPED, &p->mm->flags))
> +				ret = OOM_SCAN_CONTINUE;
> +			task_unlock(p);

OK, but perhaps it would be beter to change oom_badness() to return zero if
MMF_OOM_REAPED is set?

Oleg.

[toc] | [next] | [standalone]


#1423716

FromMichal Hocko <mhocko@kernel.org>
Date2016-06-16 08:40 +0200
Message-ID<rKz86-4OM-21@gated-at.bofh.it>
In reply to#1423092
On Wed 15-06-16 16:37:01, Oleg Nesterov wrote:
> Michal,
> 
> I am going to ack the whole series, but send some nits/questions,
> 
> On 06/09, Michal Hocko wrote:
> >
> > @@ -283,10 +283,22 @@ enum oom_scan_t oom_scan_process_thread(struct oom_control *oc,
> >  
> >  	/*
> >  	 * This task already has access to memory reserves and is being killed.
> > -	 * Don't allow any other task to have access to the reserves.
> > +	 * Don't allow any other task to have access to the reserves unless
> > +	 * the task has MMF_OOM_REAPED because chances that it would release
> > +	 * any memory is quite low.
> >  	 */
> > -	if (!is_sysrq_oom(oc) && atomic_read(&task->signal->oom_victims))
> > -		return OOM_SCAN_ABORT;
> > +	if (!is_sysrq_oom(oc) && atomic_read(&task->signal->oom_victims)) {
> > +		struct task_struct *p = find_lock_task_mm(task);
> > +		enum oom_scan_t ret = OOM_SCAN_ABORT;
> > +
> > +		if (p) {
> > +			if (test_bit(MMF_OOM_REAPED, &p->mm->flags))
> > +				ret = OOM_SCAN_CONTINUE;
> > +			task_unlock(p);
> 
> OK, but perhaps it would be beter to change oom_badness() to return zero if
> MMF_OOM_REAPED is set?

We already do that:
	if (adj == OOM_SCORE_ADJ_MIN ||
			test_bit(MMF_OOM_REAPED, &p->mm->flags) ||
			in_vfork(p)) {
		task_unlock(p);
		return 0;
	}

It is kind of subtle that we have to check it 2 times but we would have
to rework this code much more because oom_badness only can tell to
ignore the task but not to abort scanning altogether currently. If we
should change this I would suggest a separate patch.
-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web