On Wed, Feb 14, 2007 at 10:47:42PM +0300, Oleg Nesterov wrote:
> >     for (;;) {
> > -           if (cwq->wq->freezeable)
> > +           if (cwq->wq->freezeable) {
> 
> Else? This is wrong. The change like this should start from making all
> cwq->threads freezeable, otherwise it just doesn't work.

I agree we need to have all threads frozen for hotplug. Only exception I
have found is kthread workqueue, which needs to be active after
freeze_processes(). stop_machine and CPU_UP_PREPARE/kthread_create()
depend on it to work.

A worker thread (like kthread workqueue), which has exempted itself from 
hotplug-freeze, should essentially be prepared to get preempted any time and 
made to run on any cpu. If that is the case, do you see any problems in having 
the if () statement above?

> > +wait_to_die:
> > +   /* Wait for kthread_stop */
> > +   set_current_state(TASK_INTERRUPTIBLE);
> > +   while (!kthread_should_stop()) {
> > +           schedule();
> > +           set_current_state(TASK_INTERRUPTIBLE);
> > +   }
> > +   __set_current_state(TASK_RUNNING);
> > +   return 0;
> >  }
> 
> I believe this is not needed, see the comments for the next patch.

Without this, thread cleanup (cwq->should_stop)/create(CPU_UP_PREPARE) becomes 
racy 

-- 
Regards,
vatsa
-
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