Re: [PATCH] workqueue.c subtle fix and core extraction

Jeff Garzik (jgarzik@pobox.com)
Sat, 21 Jun 2003 11:43:08 -0400


Linux Kernel Mailing List wrote:
> ChangeSet 1.1384, 2003/06/20 22:14:56-07:00, akpm@digeo.com
>
> [PATCH] workqueue.c subtle fix and core extraction
>
> From: Rusty Russell <rusty@rustcorp.com.au>
>
> A barrier is needed on workqueue shutdown: there's a chance that the thead
> could see the wq->thread set to NULL before the completion is initialized.

Look at the larger problem.

The completion initialization should be done before you call
kernel_thread to start the worker.

Otherwise, there is a still the general problem: if any event occurs to
cause worker_thread to exit its main loop, you hit an uninitialized
completion.

Just initialize it before you start the kernel thread -- like all the
other driver kernel thread code does -- and forget about barriers :)
Needing a barrier here just signals you need further changes.

> Also extracts functions which actually create and destroy workqueues, for
> use by hotplug CPU patch.

Please do this in separate patches next time. I'm looking into the
above change, and including this second change just obfuscated matters
and slowed down analysis of the first change.

Jeff

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