Received: from eggs.gnu.org ([2001:4830:134:3::10]:52043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X485g-0000EY-6c for qemu-devel@nongnu.org; Mon, 07 Jul 2014 08:32:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X485X-0006V7-4V for qemu-devel@nongnu.org; Mon, 07 Jul 2014 08:32:16 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:201:233:1::3]:36598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X485W-0006Uv-V3 for qemu-devel@nongnu.org; Mon, 07 Jul 2014 08:32:07 -0400 From: Markus Armbruster References: <1404464167-5188-1-git-send-email-stefanha@redhat.com> <1404464167-5188-3-git-send-email-stefanha@redhat.com> <8738eh30gg.fsf@blackfin.pond.sub.org> <20140707081207.GA21110@stefanha-thinkpad.redhat.com> Date: Mon, 07 Jul 2014 14:32:02 +0200 In-Reply-To: <20140707081207.GA21110@stefanha-thinkpad.redhat.com> (Stefan Hajnoczi's message of "Mon, 7 Jul 2014 10:12:07 +0200") Message-ID: <878uo5tkn1.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: bump coroutine pool size for drives List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Paolo Bonzini , ming.lei@canonical.com, qemu-devel@nongnu.org Stefan Hajnoczi writes: > On Fri, Jul 04, 2014 at 12:03:27PM +0200, Markus Armbruster wrote: >> Stefan Hajnoczi 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.