[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110828180106.GC27032@redhat.com>
Date: Sun, 28 Aug 2011 20:01:06 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Tejun Heo <tj@...nel.org>
Cc: rjw@...k.pl, paul@...lmenage.org, linux-kernel@...r.kernel.org,
arnd@...db.de
Subject: Re: [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.
--
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