[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM_iQpUCN8d_d9U+wE05zxM_LWiDwqV_9pNXgquZQybQJdY+XA@mail.gmail.com>
Date: Wed, 3 Sep 2014 21:47:37 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
David Rientjes <rientjes@...gle.com>,
Michal Hocko <mhocko@...e.cz>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [Patch v3 1/2] freezer: check OOM kill while being frozen
On Wed, Sep 3, 2014 at 8:42 AM, Tejun Heo <tj@...nel.org> wrote:
> 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.
Cool.
>
> 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;
>
Sure, definitely much more readable. I will update this patch.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists