lkml.org 
[lkml]   [2009]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] create workqueue threads only when needed
Arjan van de Ven wrote:
> On Mon, 02 Feb 2009 08:37:41 +1100
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>> That's were thread pools kick in ... tried using Dave Howells slow
>> work ?
>
> async function calls are pretty much the same and actually in mainlinme.
> Dave Howells stuff in addition plays some extremely weird refcounting
> games that I cannot imagine anyone but him needing...

I haven't looked at this particular slow-work implementation. Do you
refer to some internal refcounting or to some refcounting as a service
for the API user?

IME, scheduling work and executing work is often accompanied by
reference counting of this sort:

static int schedule_delayed_work_wrapper(struct foo *container,
unsigned long delay)
{
int scheduled;

foo_get(container);
scheduled = schedule_delayed_work(&container->work, delay);
if (!scheduled)
foo_put(container);

return scheduled;
}

static void foo_work(struct work_struct *work)
{
struct foo *container =
container_of(work, struct foo, work.work);

do_the_work;

foo_put(container);
}

But I think that whenever there are additional call sites of
foo_put(container), this refcounting of container_of(work, ...) cannot
be easily generalized.
--
Stefan Richter
-=====-==--= --=- ---=-
http://arcgraph.de/sr/


\
 
 \ /
  Last update: 2009-02-02 10:05    [W:0.118 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site