Stefan Hajnoczi <stefa...@redhat.com> writes: > On Fri, Jul 04, 2014 at 12:03:27PM +0200, Markus Armbruster wrote: >> Stefan Hajnoczi <stefa...@redhat.com> writes: >> > @@ -2112,6 +2115,7 @@ void bdrv_detach_dev(BlockDriverState *bs, void *dev) >> > bs->dev_ops = NULL; >> > bs->dev_opaque = NULL; >> > bs->guest_block_size = 512; >> > + qemu_coroutine_adjust_pool_size(-64); >> > } >> > >> > /* TODO change to return DeviceState * when all users are qdevified */ >> >> This enlarges the pool regardless of how the device model uses the block >> layer. Isn't this a bit crude? >> >> Have you considered adapting the number of coroutines to actual demand? >> Within reasonable limits, of course. > > I picked the simplest algorithm because I couldn't think of one which is > clearly better. We cannot predict future coroutine usage so any > algorithm will have pathological cases.
Dynamically adapting to actual usage arguably involves less predicting than 64 * #block backends. Grow the pool some when we're running out of coroutines, shrink it some when it's been underutilized for some time. > In this case we might as well stick to the simplest implementation. Keeping it simple is always a weighty argument.