All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Konstantin Khlebnikov <khlebnikov@openvz.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Tejun Heo <htejun@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] oom: thaw threads if oom killed thread is frozen before deferring
Date: Thu, 29 Sep 2011 18:37:24 +0200	[thread overview]
Message-ID: <20110929163724.GA23773@redhat.com> (raw)
In-Reply-To: <20110929130204.GG21113@tiehlicka.suse.cz>

On 09/29, Michal Hocko wrote:
>
> On Thu 29-09-11 14:05:17, Oleg Nesterov wrote:
>
> > But of course this can't help if freeze_task() is called later.
> > May be freezable() should check TIF_MEMDIE...
>
> Wouldn't it be easier to ignore try_to_freeze when fatal signals are
> pending in get_signal_to_deliver?

Oh, I don't think so. For what? This doesn't close other races, and
in fact the fatal_signal_pending() this patch adds is itself racy,
SIGKILL can come in between.

> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -48,6 +48,11 @@ void refrigerator(void)
>  	current->flags |= PF_FREEZING;
>
>  	for (;;) {
> +		if (fatal_signal_pending(current)) {
> +			if (freezing(current) || frozen(current))
> +				thaw_process(current);

Ah, I didn't mean refrigerator() should check freezing/frozen.

I meant, oom_kill can do this before thaw thaw_process(), afaics
this should fix the particular race you described (but not others).

And. It is simply wrong to return from refrigerator() after we set
PF_FROZEN, this can fool try_to_freeze_tasks(). Sure, thaw_process()
from oom_kill is not nice too, but at least this is the special case,
we already have the problem.

Oleg.


WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Konstantin Khlebnikov <khlebnikov@openvz.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Tejun Heo <htejun@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] oom: thaw threads if oom killed thread is frozen before deferring
Date: Thu, 29 Sep 2011 18:37:24 +0200	[thread overview]
Message-ID: <20110929163724.GA23773@redhat.com> (raw)
In-Reply-To: <20110929130204.GG21113@tiehlicka.suse.cz>

On 09/29, Michal Hocko wrote:
>
> On Thu 29-09-11 14:05:17, Oleg Nesterov wrote:
>
> > But of course this can't help if freeze_task() is called later.
> > May be freezable() should check TIF_MEMDIE...
>
> Wouldn't it be easier to ignore try_to_freeze when fatal signals are
> pending in get_signal_to_deliver?

Oh, I don't think so. For what? This doesn't close other races, and
in fact the fatal_signal_pending() this patch adds is itself racy,
SIGKILL can come in between.

> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -48,6 +48,11 @@ void refrigerator(void)
>  	current->flags |= PF_FREEZING;
>
>  	for (;;) {
> +		if (fatal_signal_pending(current)) {
> +			if (freezing(current) || frozen(current))
> +				thaw_process(current);

Ah, I didn't mean refrigerator() should check freezing/frozen.

I meant, oom_kill can do this before thaw thaw_process(), afaics
this should fix the particular race you described (but not others).

And. It is simply wrong to return from refrigerator() after we set
PF_FROZEN, this can fool try_to_freeze_tasks(). Sure, thaw_process()
from oom_kill is not nice too, but at least this is the special case,
we already have the problem.

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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-09-29 16:41 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27  8:09 [PATCH 0/2] oom: fix livelock when frozen task is selected Michal Hocko
2011-09-27  6:56 ` [PATCH 1/2] lguest: move process freezing before pending signals check Michal Hocko
2011-10-12  6:55   ` Michal Hocko
2011-10-12  6:55     ` Michal Hocko
2011-10-12 23:57     ` Rusty Russell
2011-10-12 23:57       ` Rusty Russell
2011-10-13  5:48       ` Michal Hocko
2011-10-13  5:48         ` Michal Hocko
2011-09-27  8:01 ` [PATCH 2/2] oom: do not live lock on frozen tasks Michal Hocko
2011-09-27 18:35   ` [patch] oom: thaw threads if oom killed thread is frozen before deferring David Rientjes
2011-09-27 18:35     ` David Rientjes
2011-09-28 10:44     ` Michal Hocko
2011-09-28 10:44       ` Michal Hocko
2011-09-29 11:51       ` Michal Hocko
2011-09-29 11:51         ` Michal Hocko
2011-09-29 12:05         ` Oleg Nesterov
2011-09-29 12:05           ` Oleg Nesterov
2011-09-29 13:02           ` Michal Hocko
2011-09-29 13:02             ` Michal Hocko
2011-09-29 16:32             ` Michal Hocko
2011-09-29 16:32               ` Michal Hocko
2011-09-29 16:37             ` Oleg Nesterov [this message]
2011-09-29 16:37               ` Oleg Nesterov
2011-09-29 18:00               ` Michal Hocko
2011-09-29 18:00                 ` Michal Hocko
2011-09-30  1:51                 ` Tejun Heo
2011-09-30  1:51                   ` Tejun Heo
2011-09-30  7:41                   ` Michal Hocko
2011-09-30  7:41                     ` Michal Hocko
2011-09-30  7:46                     ` Tejun Heo
2011-09-30  7:46                       ` Tejun Heo
2011-09-30  8:04                       ` Michal Hocko
2011-09-30  8:04                         ` Michal Hocko
2011-09-30 15:30                 ` Oleg Nesterov
2011-09-30 15:30                   ` Oleg Nesterov
2011-10-28 22:23   ` [PATCH 2/2] oom: do not live lock on frozen tasks Andrew Morton
2011-10-28 22:23     ` Andrew Morton
2011-10-29  9:01     ` Michal Hocko
2011-10-29  9:01       ` 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=20110929163724.GA23773@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=htejun@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=khlebnikov@openvz.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    --cc=rjw@sisk.pl \
    --cc=rusty@rustcorp.com.au \
    /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.