Skip to contentSkip to conversation

The intro of QEMU block I/O throttling

PATCH Zhi Yong Wu 1 participant 1 message Sep 1, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 93 lines · Zhi Yong Wu

Return-Path: <[email protected]>
Received: from imap.linux.ibm.com ([unix socket]) by imap.linux.ibm.com (Cyrus v2.3.16-Fedora-RPM-2.3.16-6.el6_1.2) with LMTPA; Wed, 31 Aug 2011 07:10:59 -0400
X-Sieve: CMU Sieve 2.3
Received: from localhost (localhost [127.0.0.1]) by imap.linux.ibm.com (Postfix) with ESMTP id 458A11600040 for <[email protected]>; Wed, 31 Aug 2011 07:10:59 -0400 (EDT)
X-Virus-Scanned: amavisd-new at linux.ibm.com
X-Spam-Flag: NO
X-Spam-Score: -1.578
X-Spam-Level:
X-Spam-Status: No, score=-1.578 tagged_above=-9999 required=5 tests=[ALL_TRUSTED=-1, AWL=-0.037, RP_MATCHES_RCVD=-0.541] autolearn=disabled
Received: from imap.linux.ibm.com ([127.0.0.1]) by localhost (maier.raleigh.ibm.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IY4ziHLPdPGE for <[email protected]>; Wed, 31 Aug 2011 07:10:43 -0400 (EDT)
Received: from smtp.linux.ibm.com (smtp.linux.ibm.com [9.26.4.197]) by imap.linux.ibm.com (Postfix) with ESMTP id 7C6F11600046 for <[email protected]>; Wed, 31 Aug 2011 06:32:56 -0400 (EDT)
Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by smtp.linux.ibm.com (Postfix) with ESMTP id 2C79EC7A04 for <[email protected]>; Wed, 31 Aug 2011 06:32:56 -0400 (EDT)
Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7VAWtDc065946 for <[email protected]>; Wed, 31 Aug 2011 04:32:55 -0600
Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7VAWtL0020748 for <[email protected]>; Wed, 31 Aug 2011 04:32:55 -0600
Received: from VMSDVM6.POK.IBM.COM (vmsdvm6.pok.ibm.com [9.57.5.25]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7VAWskr020721 for <@vm-av.bld.relay.ibm.com:[email protected]>; Wed, 31 Aug 2011 04:32:54 -0600
Received: by VMSDVM6.POK.IBM.COM (IBM VM SMTP Level 540) via spool with SMTP id 4823 ; Wed, 31 Aug 2011 06:32:38 EDT
Received: by vmsdvm6.vnet.ibm.com (xagent2 6.3.1) via xagsmtp4 with spool id 0929 for [email protected]; Wed, 31 Aug 2011 06:32:38 -0400 (EDT)
Received: from d03relay03.boulder.ibm.com [9.17.195.228] by VMSDVM6.POK.IBM.COM (IBM VM SMTP Level 540) via TCP with ESMTP ; Wed, 31 Aug 2011 06:32:36 EDT
Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com
[9.17.195.170]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO
v10.0) with ESMTP id p7VAWpoc158318; Wed, 31 Aug 2011 04:32:52 -0600
Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by
d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id
p7V4Wp7A005389; Tue, 30 Aug 2011 22:32:51 -0600
Received: from f15.cn.ibm.com ([9.115.118.18]) by d03av04.boulder.ibm.com
(8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7V4WmrS002404
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue,
30 Aug 2011 22:32:50 -0600
Received: from f15 (localhost [127.0.0.1]) by f15.cn.ibm.com
(8.14.4/8.14.4) with ESMTP id p7VAVvbC004033; Wed, 31 Aug 2011 18:31:58
+0800
Received: (from root@localhost) by f15 (8.14.4/8.14.4/Submit) id
p7VAVphk004032; Wed, 31 Aug 2011 18:31:52 +0800
From: Zhi Yong Wu <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], Zhi Yong Wu <[email protected]>
Subject: [PATCH v6 0/4] The intro of QEMU block I/O throttling
Date: Wed, 31 Aug 2011 18:31:44 +0800
Message-Id: <[email protected]>
X-Mailer: git-send-email 1.7.6
X-Xagent-From: [email protected]
X-Xagent-To: [email protected]
X-Xagent-Gateway: vmsdvm6.vnet.ibm.com (XAGENTU5 at VMSDVM6)

The main goal of the patch is to effectively cap the disk I/O speed or counts of one single VM.It is only one draft, so it unavoidably has some drawbacks, if you catch them, please let me know.

The patch will mainly introduce one block I/O throttling algorithm, one timer and one block queue for each I/O limits enabled drive.

When a block request is coming in, the throttling algorithm will check if its I/O rate or counts exceed the limits; if yes, then it will enqueue to the block queue; The timer will handle the I/O requests in it.

Some available features follow as below:
(1) global bps limit.
-drive bps=xxx in bytes/s
(2) only read bps limit
-drive bps_rd=xxx in bytes/s
(3) only write bps limit
-drive bps_wr=xxx in bytes/s
(4) global iops limit
-drive iops=xxx in ios/s
(5) only read iops limit
-drive iops_rd=xxx in ios/s
(6) only write iops limit
-drive iops_wr=xxx in ios/s
(7) the combination of some limits.
-drive bps=xxx,iops=xxx

Quoted 7 lines

Known Limitations:
(1) #1 can not coexist with #2, #3
(2) #4 can not coexist with #5, #6
(3) When bps/iops limits are specified to a small value such as 511 bytes/s, this VM will hang up. We are considering how to handle this senario.

Changes since code V5:
Mainly fix the aio callback issue for block queue.

Sorry, thanks Ram Pai, some code changes based on his comments.

Quoted 42 lines

Zhi Yong Wu (4):
block: add the command line support
block: add the block queue support
block: add block timer and block throttling algorithm qmp/hmp: add block_set_io_throttle

v5: add qmp/hmp support.
Adjust the codes based on stefan's comments
qmp/hmp: add block_set_io_throttle

v4: fix memory leaking based on ryan's feedback.

v3: Added the code for extending slice time, and modified the method to compute wait time for the timer.

v2: The codes V2 for QEMU disk I/O limits.
Modified the codes mainly based on stefan's comments.

v1: Submit the codes for QEMU disk I/O limits.
Only a code draft.

Makefile.objs     |    2 +-
block.c           |  324 +++++++++++++++++++++++++++++++++++++++++++++++++++--
block.h           |    6 +-
block/blk-queue.c |  226 +++++++++++++++++++++++++++++++++++++
block/blk-queue.h |   63 ++++++++++
block_int.h       |   30 +++++
blockdev.c        |   98 ++++++++++++++++
blockdev.h        |    2 +
hmp-commands.hx   |   15 +++
qemu-config.c     |   24 ++++
qemu-options.hx   |    1 +
qerror.c          |    4 +
qerror.h          |    3 +
qmp-commands.hx   |   52 +++++++++-
14 files changed, 837 insertions(+), 13 deletions(-)

create mode 100644 block/blk-queue.c
create mode 100644 block/blk-queue.h

Signature · 1 line
1.7.6