Re: [4/7] dst: thread pool.

Evgeniy Polyakov
2009-01-15T08:47:45Z

Hi Andrew.

On Wed, Jan 14, 2009 at 09:58:10PM -0800, Andrew Morton (akpm@linux-foundation.org) wrote:
> > Kernel currently does not allow to queue work into some entity which
> > will perform it in the process context and have simple way to extend
> > number of worker and work with them not as separate objects, but with
> > pool as a whole. So thread pool model was implemented in the DST.
> >
> > Thread pool abstraction allows to schedule a work to be performed
> > on behalf of kernel thread. One does not operate with threads itself,
> > instead user provides setup and cleanup callbacks for thread pool itself,
> > and action and cleanup callbacks for each submitted work.
> >
> > Each worker has private data initialized at creation time and data,
> > provided by user at scheduling time.
> >
> > When action is being performed, thread can not be used by other users,
> > instead they will sleep until there is free thread to pick their work.
> >
> > Thread pool is used for crypto processing of incoming and outgoing IO
> > requests to reduce the overall overhead.
>
> This is at least our fourth thread pool implementation, not counting
> kernel/workqueue.c:
>
> 1: pdflush

It is not really a pool of threads. But its works is somewhat similar.

> 2: David Howells' "slow work" infrastructure

I did not check it, it was not sent to fsdevel and only couple of
replies sneaked, according to them there are questionable cases (like
lots of global variables), but overall I can not say more.

> 3: Arjan van de Ven's kernel/async.c

Arjan does not answer to the mails. I sent him a review with
constructive critics, but it got lost in the void :)

> 4: Your "dst thread pool"

This one is rather simple case: set of thrads and blocking callbacks to
add the work.

--
Evgeniy Polyakov