linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Michal Hocko <mhocko@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"\\\"Rafael J. Wysocki\\\"" <rjw@rjwysocki.net>,
	David Rientjes <rientjes@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH -v3 5/5] oom, PM: make OOM detection in the freezer path raceless
Date: Sat, 10 Jan 2015 14:43:22 -0500	[thread overview]
Message-ID: <20150110194322.GE25319@htj.dyndns.org> (raw)
In-Reply-To: <1420801555-22659-6-git-send-email-mhocko@suse.cz>

On Fri, Jan 09, 2015 at 12:05:55PM +0100, Michal Hocko wrote:
...
> @@ -142,7 +118,6 @@ static bool check_frozen_processes(void)
>  int freeze_processes(void)
>  {
>  	int error;
> -	int oom_kills_saved;
>  
>  	error = __usermodehelper_disable(UMH_FREEZING);
>  	if (error)
> @@ -157,29 +132,22 @@ int freeze_processes(void)
>  	pm_wakeup_clear();
>  	pr_info("Freezing user space processes ... ");
>  	pm_freezing = true;
> -	oom_kills_saved = oom_kills_count();
>  	error = try_to_freeze_tasks(true);
>  	if (!error) {
>  		__usermodehelper_set_disable_depth(UMH_DISABLED);
> -		oom_killer_disable();
> -
> -		/*
> -		 * There might have been an OOM kill while we were
> -		 * freezing tasks and the killed task might be still
> -		 * on the way out so we have to double check for race.
> -		 */
> -		if (oom_kills_count() != oom_kills_saved &&
> -		    !check_frozen_processes()) {
> -			__usermodehelper_set_disable_depth(UMH_ENABLED);
> -			pr_cont("OOM in progress.");
> -			error = -EBUSY;
> -		} else {
> -			pr_cont("done.");
> -		}
> +		pr_cont("done.");
>  	}
>  	pr_cont("\n");
>  	BUG_ON(in_atomic());
>  
> +	/*
> +	 * Now that the whole userspace is frozen we need to disbale
> +	 * the OOM killer to disallow any further interference with
> +	 * killable tasks.
> +	 */
> +	if (!error && !oom_killer_disable())

So, previously, oom killer was disabled at the top of
freeze_kernel_threads(), right?  I think that was the better spot to
do that.  We don't want to disable oom killer before the system is
just about to enter total quiescence which is freeze_kernel_threads().
We want to delay this as long as possible.  Let's please disable oom
killing in at the top of freeze_kernel_threads() and re-enable at the
bottom of thaw_kernel_threads().

Thanks.

-- 
tejun

--
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>

  parent reply	other threads:[~2015-01-10 19:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 11:05 [PATCH -v3 0/5] OOM vs PM freezer fixes Michal Hocko
2015-01-09 11:05 ` [PATCH -v3 1/5] oom: add helpers for setting and clearing TIF_MEMDIE Michal Hocko
2015-01-09 11:05 ` [PATCH -v3 2/5] oom: thaw the OOM victim if it is frozen Michal Hocko
2015-01-09 11:05 ` [PATCH -v3 3/5] PM: convert printk to pr_* equivalent Michal Hocko
2015-01-09 11:05 ` [PATCH -v3 4/5] sysrq: " Michal Hocko
2015-01-09 11:05 ` [PATCH -v3 5/5] oom, PM: make OOM detection in the freezer path raceless Michal Hocko
2015-01-10  0:54   ` Cong Wang
2015-01-10 19:43   ` Tejun Heo [this message]
2015-01-12 16:10     ` Michal Hocko
2015-01-12 17:22       ` Tejun Heo
2015-01-12 17:35         ` Michal Hocko
2015-01-12 23:59 ` [PATCH -v3 0/5] OOM vs PM freezer fixes Andrew Morton
2015-01-13  8:41   ` Michal Hocko

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=20150110194322.GE25319@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=oleg@redhat.com \
    --cc=rientjes@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=xiyou.wangcong@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).