All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Ma, Xindong" <xindong.ma@intel.com>, Sameer Nanda <snanda@chromium.org>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mhocko@suse.cz" <mhocko@suse.cz>,
	"rientjes@google.com" <rientjes@google.com>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"rusty@rustcorp.com.au" <rusty@rustcorp.com.au>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	'Peter Zijlstra' <peterz@infradead.org>,
	"'gregkh@linuxfoundation.org'" <gregkh@linuxfoundation.org>,
	"Tu, Xiaobing" <xiaobing.tu@intel.com>
Subject: Re: [PATCH] Fix race between oom kill and task exit
Date: Thu, 28 Nov 2013 19:37:02 +0100	[thread overview]
Message-ID: <20131128183702.GC20740@redhat.com> (raw)
In-Reply-To: <3917C05D9F83184EAA45CE249FF1B1DD0253093A@SHSMSX103.ccr.corp.intel.com>

On 11/28, Ma, Xindong wrote:
>
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -412,16 +412,6 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
>  	static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL,
>  					      DEFAULT_RATELIMIT_BURST);
>  
> -	/*
> -	 * If the task is already exiting, don't alarm the sysadmin or kill
> -	 * its children or threads, just set TIF_MEMDIE so it can die quickly
> -	 */
> -	if (p->flags & PF_EXITING) {
> -		set_tsk_thread_flag(p, TIF_MEMDIE);
> -		put_task_struct(p);
> -		return;
> -	}
> -
>  	if (__ratelimit(&oom_rs))
>  		dump_header(p, gfp_mask, order, memcg, nodemask);
>  
> @@ -437,6 +427,16 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
>  	 * still freeing memory.
>  	 */
>  	read_lock(&tasklist_lock);
> +	/*
> +	 * If the task is already exiting, don't alarm the sysadmin or kill
> +	 * its children or threads, just set TIF_MEMDIE so it can die quickly
> +	 */
> +	if (p->flags & PF_EXITING) {
> +		set_tsk_thread_flag(p, TIF_MEMDIE);
> +		put_task_struct(p);
> +		read_unlock(&tasklist_lock);
> +		return;
> +	}

I got lost... didn't we recently discussed the similar patch from Sameer?

This one doesn't look right. find_lock_task_mm() after unlock(tasklist)
can hit the same problem.

I belive the patch from Sameer was correct.

Oleg.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: "Ma, Xindong" <xindong.ma@intel.com>, Sameer Nanda <snanda@chromium.org>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mhocko@suse.cz" <mhocko@suse.cz>,
	"rientjes@google.com" <rientjes@google.com>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"rusty@rustcorp.com.au" <rusty@rustcorp.com.au>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"'Peter Zijlstra'" <peterz@infradead.org>,
	"'gregkh@linuxfoundation.org'" <gregkh@linuxfoundation.org>,
	"Tu, Xiaobing" <xiaobing.tu@intel.com>
Subject: Re: [PATCH] Fix race between oom kill and task exit
Date: Thu, 28 Nov 2013 19:37:02 +0100	[thread overview]
Message-ID: <20131128183702.GC20740@redhat.com> (raw)
In-Reply-To: <3917C05D9F83184EAA45CE249FF1B1DD0253093A@SHSMSX103.ccr.corp.intel.com>

On 11/28, Ma, Xindong wrote:
>
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -412,16 +412,6 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
>  	static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL,
>  					      DEFAULT_RATELIMIT_BURST);
>  
> -	/*
> -	 * If the task is already exiting, don't alarm the sysadmin or kill
> -	 * its children or threads, just set TIF_MEMDIE so it can die quickly
> -	 */
> -	if (p->flags & PF_EXITING) {
> -		set_tsk_thread_flag(p, TIF_MEMDIE);
> -		put_task_struct(p);
> -		return;
> -	}
> -
>  	if (__ratelimit(&oom_rs))
>  		dump_header(p, gfp_mask, order, memcg, nodemask);
>  
> @@ -437,6 +427,16 @@ void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
>  	 * still freeing memory.
>  	 */
>  	read_lock(&tasklist_lock);
> +	/*
> +	 * If the task is already exiting, don't alarm the sysadmin or kill
> +	 * its children or threads, just set TIF_MEMDIE so it can die quickly
> +	 */
> +	if (p->flags & PF_EXITING) {
> +		set_tsk_thread_flag(p, TIF_MEMDIE);
> +		put_task_struct(p);
> +		read_unlock(&tasklist_lock);
> +		return;
> +	}

I got lost... didn't we recently discussed the similar patch from Sameer?

This one doesn't look right. find_lock_task_mm() after unlock(tasklist)
can hit the same problem.

I belive the patch from Sameer was correct.

Oleg.


  parent reply	other threads:[~2013-11-28 18:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28  5:09 [PATCH] Fix race between oom kill and task exit Ma, Xindong
2013-11-28  5:09 ` Ma, Xindong
2013-11-28  6:35 ` Johannes Weiner
2013-11-28  6:35   ` Johannes Weiner
2013-11-28  8:41   ` William Dauchy
2013-11-28  8:41     ` William Dauchy
2013-11-28 12:00     ` Michal Hocko
2013-11-28 12:00       ` Michal Hocko
2013-11-28 17:57       ` Vladimir Murzin
2013-11-28 17:57         ` Vladimir Murzin
2013-11-28 18:38       ` Oleg Nesterov
2013-11-28 18:38         ` Oleg Nesterov
2013-11-29  2:06         ` Ma, Xindong
2013-11-29  2:06           ` Ma, Xindong
2013-11-29  2:08           ` Tu, Xiaobing
2013-11-29  2:08             ` Tu, Xiaobing
2013-12-02 14:12         ` Oleg Nesterov
2013-12-02 14:12           ` Oleg Nesterov
2013-12-05  0:56           ` David Rientjes
2013-12-05  0:56             ` David Rientjes
2013-12-05 17:29             ` Oleg Nesterov
2013-12-05 17:29               ` Oleg Nesterov
2013-12-05 23:35               ` David Rientjes
2013-12-05 23:35                 ` David Rientjes
2013-12-06 15:19                 ` Oleg Nesterov
2013-12-06 15:19                   ` Oleg Nesterov
2013-12-06 15:52                   ` Oleg Nesterov
2013-12-06 15:52                     ` Oleg Nesterov
2013-12-06 17:54                   ` Sameer Nanda
2013-12-06 17:54                     ` Sameer Nanda
2013-11-28  9:18   ` azurIt
2013-11-28  9:18     ` azurIt
2013-11-28 18:37 ` Oleg Nesterov [this message]
2013-11-28 18:37   ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131128183702.GC20740@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=rusty@rustcorp.com.au \
    --cc=snanda@chromium.org \
    --cc=xiaobing.tu@intel.com \
    --cc=xindong.ma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.