lkml.org 
[lkml]   [2011]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/16] freezer: fix set_freezable[_with_signal]() race
On 08/19, Tejun Heo wrote:
>
> A kthread doing set_freezable*() may race with on-going PM freeze and
> the freezer might think all tasks are frozen while the new freezable
> kthread is marrily proceeding to execute code paths which aren't
> supposed to be executing during PM freeze.

Yes,

> +bool __set_freezable(bool with_signal)
> +{
> + might_sleep();
> +
> + /*
> + * Modify flags while holding freezer_lock. This ensures the
> + * freezer notices that we aren't frozen yet or the freezing
> + * condition is visible to try_to_freeze() below.
> + */
> + spin_lock_irq(&freezer_lock);
> + current->flags &= ~PF_NOFREEZE;
> + if (with_signal)
> + current->flags &= ~PF_FREEZER_NOSIG;
> + spin_unlock_irq(&freezer_lock);
> +
> + return try_to_freeze();
> +}

You know, I was really, really puzzled by this change. Because it
"obviously can fix nothing", and try_to_freeze() makes no sense
(ignoring the very unlikely case when TIF_FREEZING was set right
after we drop freezer_lock).

But I guess this works along with 14/16 which removes TIF_FREEZING.

Oleg.



\
 
 \ /
  Last update: 2011-08-28 20:07    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site