On Saturday, 12 May 2007 18:58, Oleg Nesterov wrote: > On 05/12, Rafael J. Wysocki wrote: > > > > Ah, I see. We spawn a kernel thread from a code path that belongs to a > > user space task and we need to call deamonize() to make it become a > > 'real' kernel thread. > > > > Still, this means that is_user_space() may return 'true' for this thread > > before it calls daemonize() and then the scenario described by me in the > > previous message may occur. It seems. > > Yes sure. Probably not so bad in practice. Most likely this fresh thread > is not "important" and could be freezed, I dunno.
I don't know too, and that's why I'd like to prevent this from happening. > > It's in freezer-fix-pf_nofreeze-vs-freezeable-race.patch (appended for > > convenience, white space may be broken). > > > > --- > > --- a/include/linux/freezer.h~freezer-fix-pf_nofreeze-vs-freezeable-race > > +++ a/include/linux/freezer.h > > @@ -63,8 +63,10 @@ static inline int thaw_process(struct ta > > */ > > static inline void frozen_process(struct task_struct *p) > > { > > - p->flags |= PF_FROZEN; > > - wmb(); > > + if (!unlikely(p->flags & PF_NOFREEZE)) { > > + p->flags |= PF_FROZEN; > > + wmb(); > > + } > > clear_tsk_thread_flag(p, TIF_FREEZE); > > } > > This is OK if a kernel thread does try_to_freeze() eventually. > > But what if it does not, because it marks itself as PF_NOFREEZE? > This means it may run with signal_pending() forever. That is why > I think we should clear TIF_FREEZE when we set PF_NOFREEZE. Yes, we should. Greetings, Rafael - 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/