Re: [RFC][PATCH] create workqueue threads only when needed
From: Stefan Richter
Date: Mon Feb 02 2009 - 04:02:27 EST
Arjan van de Ven wrote:
> On Mon, 02 Feb 2009 08:37:41 +1100
> Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> 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/
--
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/