Re: [RFC PATCH(Experimental) 1/4] freezer-cpu-hotplug core

From: Oleg Nesterov
Date: Fri Feb 16 2007 - 10:48:20 EST


On 02/16, Srivatsa Vaddagiri wrote:
>
> 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.

Well, only multithreaded, strictly speaking.

> 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.

Yes. That is why I worried about freeze_processes() before CPU_UP_PREPARE.

> 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?

helper_wq ("kthread") is singlethread (see above), but this is not nice to
rely on that. (I am not sure I undestand you though).

> > > +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

Could you explain? (Again, perhaps you are talking about the old code).

Oleg.

-
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/