Re: [PATCH] QStor SATA/RAID driver for 2.6.9-rc3

From: James Bottomley
Date: Tue Oct 12 2004 - 12:28:15 EST


On Tue, 2004-10-12 at 11:59, Mark Lord wrote:
> Yes. The workqueue thread will invoke the mid-layer function,
> which will do a queuecommand, which will return to the mid-layer,
> which will then SLEEP waiting for the command to complete,
> which will sleep that workqueue thread.
>
> As part of the interrupt processing to complete the command in the LLD,
> it is possible that schedule_work may be necessary, requiring that
> a workqueue thread be run. If this means the same thread that is
> already sleeping courtesy of the mid-layer, then we could have a problem.
>
> Comments?

Erm, perhaps you don't understand the concept of a work queue. It's a
queue of pending work. There's a back end daemon servicing the queue
and executing all the items on the queue in sequence. schedule_work
just adds an item of work to the queue and returns.

So, it's perfectly legal to call schedule_work from within the work
queue function, because all you do is add the work to the list for the
daemon thread to execute when it gets to it. There's nothing
synchronous about a workqueue. If a work function sleeps, then its
true, it takes the worker thread longer to get to the next work item,
but as long as the work function awakes, it will get there.

James


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