Re: [PATCH 04/16] freezer: implement and usekthread_freezable_should_stop()

From: Tejun Heo
Date: Mon Aug 22 2011 - 05:54:19 EST


Hey, Oleg.

On Sun, Aug 21, 2011 at 09:14:21PM +0200, Oleg Nesterov wrote:
> But. can't __refrigerator() race with thaw_process() in this case?
>
> > +bool __refrigerator(bool check_kthr_stop)
> > {
> > /* Hmm, should we be allowed to suspend when there are realtime
> > processes around? */
> > @@ -50,7 +51,8 @@ bool __refrigerator(void)
> >
> > for (;;) {
> > set_current_state(TASK_UNINTERRUPTIBLE);
> > - if (!frozen(current))
> > + if (!frozen(current) ||
> > + (check_kthr_stop && kthread_should_stop()))
> > break;
>
> OK, but then we do
>
> current->flags &= ~PF_FREEZING;
>
> since PF_FROZEN wasn't cleared this can race with
>
> p->flags &= ~PF_FROZEN;
>
> No?

Indeed, I removed PF_FREEZING and moved PF_FROZEN to __refrigerator()
in later patches, so it's already gone. Patches could have been
sequenced better, I suppose. But, sequencing fixes for different
races was already pretty challenging. :)

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/