Re: workqueue thing

Stijn Devriendt
2009-12-23T08:31:13Z

On Tue, Dec 22, 2009 at 12:50 AM, Tejun Heo <tj@kernel.org> wrote:
>>  2) doesn't deal with cpu heavy tasks/wakeup parallelism
>
> workqueue was never suited for this.  MT workqueues have strong CPU
> affinity which doesn't make sense for CPU-heavy workloads.

It does, really. Have a look at TBB and others. You always want to keep
workqueue items as close to the scheduling thread as possible as the
chance of having a hot cache and TLBs and such are far greater.
The end result is CPU-affine threads fetching work from CPU-affine
queues with workitems scheduled by a thread on that CPU.
To improve parallellism, workqueue threads with empty workqueues
start stealing work away from non-empty workqueues.
The added warmup doesn't weigh in against the added parallellism
in those cases.

Stijn