Re: [RFC][PATCH] create workqueue threads only when needed

From: Benjamin Herrenschmidt
Date: Mon Feb 02 2009 - 04:07:37 EST


On Mon, 2009-02-02 at 09:42 +0100, Stefan Richter wrote:

> >
> > IE. It will be pretty responsive -in general- but can suffer form
> > horrible latencies every now and then.
>
> Actually it /should/ be the other way around:
>
> The shared workqueue should only be used for work that sleeps only
> briefly (perhaps with the exception of very unlikely longer sleeps e.g.
> for allocations that cause paging).

I agree, I'm just stating the current situation :-) Hopefully something
like async funcs / slow work / whatever will take over the case of stuff
that wants to be around for longer. I haven't had a chance to look at
the async funcs yet, sounds like they may do the job tho in which case
I'll look at converting a driver or two to use them.

> Work which /may/ sleep longer, for example performs SCSI transactions,
> needs to go into a private workqueue or other kind of context.

Well, it's a bit silly to allocate a private workqueue with all it's
associated per CPU kernel threads for something as rare as resetting
your eth NIC ... or even SCSI error handling in fact.

> OTOH you are right too; work which must not be deferred too long by work
> from another uncooperative/ unfair subsystem is probably also better off
> in an own workqueue...

I suspect the main reason for dedicated work queues is that, plus the
per-CPU affinity.

Cheers,
Ben.

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