On Sat, 29 Aug 2009, Rafael J. Wysocki wrote: > On Saturday 29 August 2009, Rafael J. Wysocki wrote: > > On Saturday 29 August 2009, Alan Stern wrote: > ... > > > Strictly speaking, a new thread should be started only when needed. > > > That is, only when all the existing threads are busy running a > > > callback. It shouldn't be too hard to keep track of when that happens. > > > > The async framework does that for us. :-) > > So, when I said "async threads", I should have rather said "async functions", > because one async thread can execute multiple functions scheduled with > async_schedule(). > > Taking that into consideration, it all works like this. When there's a new > async device to handle and there are no async threads available, a new thread > is started and it runs the async function that handles the device and > "opportunistically" searches dpm_list (once) for other device that are ready > for handling. After this function has returned, the thread goes to sleep and > it only exits after being idle for 1 s. In turn, when there's a new async > device to handle and there are async threads available, on of them gets the > async function to run. > > I don't really think we can do much better than this in any other approach. Since it obviously works and is relatively simple, I guess we ought to adopt it. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html