From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFo9s-0004Lv-3d for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:40:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFo9l-0006ha-RB for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:40:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFo9l-0006hM-JT for qemu-devel@nongnu.org; Fri, 08 Aug 2014 13:40:45 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s78HejRC016923 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 8 Aug 2014 13:40:45 -0400 From: Kevin Wolf Date: Fri, 8 Aug 2014 19:39:29 +0200 Message-Id: <1407519603-6635-29-git-send-email-kwolf@redhat.com> In-Reply-To: <1407519603-6635-1-git-send-email-kwolf@redhat.com> References: <1407519603-6635-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 28/62] block: bump coroutine pool size for drives List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Stefan Hajnoczi When a BlockDriverState is associated with a storage controller DeviceState we expect guest I/O. Use this opportunity to bump the coroutine pool size by 64. This patch ensures that the coroutine pool size scales with the number of drives attached to the guest. It should increase coroutine pool usage (which makes qemu_coroutine_create() fast) without hogging too much memory when fewer drives are attached. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- block.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block.c b/block.c index ea14981..13a1059 100644 --- a/block.c +++ b/block.c @@ -57,6 +57,8 @@ struct BdrvDirtyBitmap { #define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */ +#define COROUTINE_POOL_RESERVATION 64 /* number of coroutines to reserve */ + static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load); static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, @@ -2114,6 +2116,9 @@ int bdrv_attach_dev(BlockDriverState *bs, void *dev) } bs->dev = dev; bdrv_iostatus_reset(bs); + + /* We're expecting I/O from the device so bump up coroutine pool size */ + qemu_coroutine_adjust_pool_size(COROUTINE_POOL_RESERVATION); return 0; } @@ -2133,6 +2138,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(-COROUTINE_POOL_RESERVATION); } /* TODO change to return DeviceState * when all users are qdevified */ -- 1.8.3.1