mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	David Rientjes <rientjes@google.com>,
	Michal Hocko <mhocko@suse.cz>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [Patch v3 1/2] freezer: check OOM kill while being frozen
Date: Wed, 3 Sep 2014 11:42:19 -0400	[thread overview]
Message-ID: <20140903154219.GA30011@mtj.dyndns.org> (raw)
In-Reply-To: <CAM_iQpVaWR-jZN3RByZgGsytRnv0NBxbXh_Y1WSdJqhasuygaQ@mail.gmail.com>

Hello, Cong.

On Tue, Sep 02, 2014 at 03:52:40PM -0700, Cong Wang wrote:
> diff --git a/kernel/freezer.c b/kernel/freezer.c
> index 33cbcb0..b06a059 100644
> --- a/kernel/freezer.c
> +++ b/kernel/freezer.c
> @@ -56,7 +56,8 @@ static bool should_thaw_current(bool check_kthr_stop)
>  {
>         if (!freezing(current) ||
>             (check_kthr_stop && kthread_should_stop()) ||
> -           test_thread_flag(TIF_MEMDIE))
> +           /* It might not be safe to check TIF_MEMDIE for pm freeze */
> +           (cgroup_freezing(current) && test_thread_flag(TIF_MEMDIE)))
>                 return true;
>         else
>                 return false;
> 
> Are you happy now, Tejun? :)

Yes, this should be a lot safer.  The function still looks weird to me
tho.

	if (cond)
		return true;
	else
		return false;

is equivalent to

	return cond;

If you're worried that the conditional is too complex and harms
readability you can do

	/* explain cond0 */
	if (cond0)
		return true;

	/* explain cond1 */
	if (cond1)
		return true;

	return false;

Thanks.

-- 
tejun

  reply	other threads:[~2014-09-03 15:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-14 21:15 Cong Wang
2014-08-14 21:15 ` [Patch v3 2/2] freezer: remove obsolete comments in __thaw_task() Cong Wang
2014-08-15  8:23   ` Michal Hocko
2014-08-16 12:20 ` [Patch v3 1/2] freezer: check OOM kill while being frozen Tejun Heo
2014-08-16 18:58   ` Cong Wang
2014-09-02 22:52   ` Cong Wang
2014-09-03 15:42     ` Tejun Heo [this message]
2014-09-04  4:47       ` Cong Wang

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=20140903154219.GA30011@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --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

all inboxes | Powered by JetHome®