Messages in this thread | | | Date | Mon, 02 Feb 2009 10:01:56 +0100 | From | Stefan Richter <> | Subject | Re: [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/
| |