From patchwork Wed Mar 20 09:12:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Canet?= X-Patchwork-Id: 229274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A104F2C00AB for ; Wed, 20 Mar 2013 20:12:42 +1100 (EST) Received: from localhost ([::1]:41394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIF4a-0005b3-Qi for incoming@patchwork.ozlabs.org; Wed, 20 Mar 2013 05:12:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIF3U-0004eL-W8 for qemu-devel@nongnu.org; Wed, 20 Mar 2013 05:11:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIF3R-0002jJ-M4 for qemu-devel@nongnu.org; Wed, 20 Mar 2013 05:11:32 -0400 Received: from nodalink.pck.nerim.net ([62.212.105.220]:33398 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIF3R-0002jB-Dg for qemu-devel@nongnu.org; Wed, 20 Mar 2013 05:11:29 -0400 Received: by paradis.irqsave.net (Postfix, from userid 1002) id AD584874186; Wed, 20 Mar 2013 10:11:28 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.77.1]) by paradis.irqsave.net (Postfix) with ESMTP id A98AF87432A; Wed, 20 Mar 2013 10:11:12 +0100 (CET) From: =?UTF-8?q?Beno=C3=AEt=20Canet?= To: qemu-devel@nongnu.org Date: Wed, 20 Mar 2013 10:12:14 +0100 Message-Id: <1363770734-30970-2-git-send-email-benoit@irqsave.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1363770734-30970-1-git-send-email-benoit@irqsave.net> References: <1363770734-30970-1-git-send-email-benoit@irqsave.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 62.212.105.220 Cc: kwolf@redhat.com, wuzhy@linux.vnet.ibm.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , stefanha@redhat.com Subject: [Qemu-devel] [PATCH] block: fix bdrv_exceed_iops_limits wait computation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch fix an I/O throttling behavior triggered by limiting at 150 iops and running a load of 50 threads doing random pwrites on a raw virtio device. After a few moments the iops count start to oscillate steadily between 0 and a value upper than the limit. As the load keep running the period and the amplitude of the oscillation increase until io bursts reaching the physical storage max iops count are done. These bursts are followed by guest io starvation. As the period of this oscillation cycle is increasing the cause must be a computation error leading to increase slowly the wait time. This patch make the wait time a bit smaller and tests confirm that it solves the oscillating behavior. Signed-off-by: Benoit Canet Reviewed-by: Zhi Yong Wu --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 0a062c9..455d8b0 100644 --- a/block.c +++ b/block.c @@ -3739,7 +3739,7 @@ static bool bdrv_exceed_iops_limits(BlockDriverState *bs, bool is_write, } /* Calc approx time to dispatch */ - wait_time = (ios_base + 1) / iops_limit; + wait_time = ios_base / iops_limit; if (wait_time > elapsed_time) { wait_time = wait_time - elapsed_time; } else {