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

From: Jeff Garzik (
Date: Sat Jun 21 2003 - 10:43:08 EST

Linux Kernel Mailing List wrote:
> ChangeSet 1.1384, 2003/06/20 22:14:56-07:00,
> [PATCH] workqueue.c subtle fix and core extraction
> From: Rusty Russell <>
> 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

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.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:36 EST