From patchwork Mon Feb 22 22:01:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 8384011 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62C59C0553 for ; Mon, 22 Feb 2016 22:02:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83F98203B0 for ; Mon, 22 Feb 2016 22:02:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9761201EC for ; Mon, 22 Feb 2016 22:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756015AbcBVWBo (ORCPT ); Mon, 22 Feb 2016 17:01:44 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:41811 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755745AbcBVWBm (ORCPT ); Mon, 22 Feb 2016 17:01:42 -0500 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u1MLqJp4030773 for ; Mon, 22 Feb 2016 14:01:41 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=em8WzcCdWUX7aokdi/tDZMc5FcA6AYSkKqw9xR+fF2A=; b=IiVlihGvrJ08NAKVOolHHYdEIDe6By3EuY3fV2rGn0oAHz2J/SUwqT+sR93Ld2ezxZxR StM0SI/OuA5UQfuErKVR2HWhqCgGLWKba3BVsp7zCRYqFmaFHrcBSibl3ujCsMZ6L5BU L61uzrhm5ihocolVg16Af9ZjzdWxA1SLc0g= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2189n8r92y-3 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Mon, 22 Feb 2016 14:01:40 -0800 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB07.TheFacebook.com (192.168.16.17) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 22 Feb 2016 14:01:32 -0800 Received: from facebook.com (2401:db00:11:d0a2:face:0:39:0) by mx-out.facebook.com (10.223.100.99) with ESMTP id d4765d3cd9af11e5affc24be05956610-d7ad3270 for ; Mon, 22 Feb 2016 14:01:31 -0800 Received: by devbig084.prn1.facebook.com (Postfix, from userid 11222) id 5295647E31B1; Mon, 22 Feb 2016 14:01:29 -0800 (PST) From: Shaohua Li To: , CC: , , Vivek Goyal , "jmoyer @ redhat . com" , Subject: [PATCH V2 10/13] blk-throttle: over estimate bandwidth Date: Mon, 22 Feb 2016 14:01:25 -0800 Message-ID: X-Mailer: git-send-email 2.6.5 In-Reply-To: References: X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-02-22_08:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we don't dispatch enough requests, disk can't reach the max bandwidth. As we don't know the max bandwidth, we over estimate the bandwidth and dispatch more requests. This way the disk can reach the max bandwidth slowly. The downside is this can introduce fairness issue, but since we only over estimate 1/8 extra bandwidth, the fairness issue isn't big. But again, this could cause fairness issue for specific workloads. Signed-off-by: Shaohua Li --- block/blk-throttle.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 68e2598..f78d470 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -281,6 +281,8 @@ static inline uint64_t queue_bandwidth(struct throtl_data *td) /* can't estimate bandwidth, can't do proporation control */ if (bw == 0) bw = -1; + else + bw += bw >> 3; return bw; } @@ -292,6 +294,8 @@ static inline uint64_t queue_iops(struct throtl_data *td) /* can't estimate iops, can't do proporation control */ if (iops == 0) iops = -1; + else + iops += iops >> 3; return iops; }