On 04/04, Srivatsa Vaddagiri wrote:
>
> On Wed, Apr 04, 2007 at 07:28:28PM +0400, Oleg Nesterov wrote:
> > 
> >     worker_thread:
> > 
> >             for (;;) {
> >                     try_to_freeze();
> > 
> >                     prepare_to_wait();
> >                     if (...)
> >                             schedule();
> >                     finish_wait();
> >             }
> > 
> > This is racy, we can miss freeze_process()->signal_wake_up() if it happens
> > between try_to_freeze() and prepare_to_wait(). We have to check TIF_FREEZE
> > before entering schedule() if we want to fix this race.
> 
> Yes that needs a fix as well. Oh dear, freezer is so fragile to break!
> 
> > Should we? I don't know. This will uglify the code, and the probability
> > of this race is very low.
> 
> Would be nice to fix IMO. Atleast serves to show "how to make your code
> freezer friendly".

This is funny. I "noticed" this race a long ago, when the ->freezeable flag
was introduced. However, looking at 2.6.20 I see that the patch was correct,
and this race was in fact introduced by me in

        [PATCH 1/1] workqueue: don't migrate pending works from the dead CPU
        http://marc.info/?l=linux-kernel&m=117062192709871

I'll send a fix on weekend.

Oleg.

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

Reply via email to