From patchwork Mon Feb 22 22:01:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 8384001 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 ADF42C0553 for ; Mon, 22 Feb 2016 22:02:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA3BE203B0 for ; Mon, 22 Feb 2016 22:02:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFD82201EC for ; Mon, 22 Feb 2016 22:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756023AbcBVWBp (ORCPT ); Mon, 22 Feb 2016 17:01:45 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:47004 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756013AbcBVWBn (ORCPT ); Mon, 22 Feb 2016 17:01:43 -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 u1MLqJp9030773 for ; Mon, 22 Feb 2016 14:01:43 -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=hSahMeZFsJspUfZz7JDrIGfAW7hfhk/0fFTTGF4ypTE=; b=JyvG/VtO2148iUsDOVE/1T3r0GNRA1ptbXwVd4Gk/Io/wjb17NKtsr0vgh2sA1h0yNfv jpkaqUw0E1oYdBqaeBgvxvShEOGP0+R0aAcr/wzqEeDkoldksxJW0EPj7uvOWmZoza9z XSeO945jQwfc48vxUoiGbYjUvoStT7sIwDA= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2189n8r92y-4 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Mon, 22 Feb 2016 14:01:42 -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.101.97) with ESMTP id d4a8eac2d9af11e58f4624be0595f910-c61f8270 for ; Mon, 22 Feb 2016 14:01:31 -0800 Received: by devbig084.prn1.facebook.com (Postfix, from userid 11222) id 8FD2847E31F2; Mon, 22 Feb 2016 14:01:29 -0800 (PST) From: Shaohua Li To: , CC: , , Vivek Goyal , "jmoyer @ redhat . com" , Subject: [PATCH V2 12/13] blk-throttle: restore shrinked cgroup share Date: Mon, 22 Feb 2016 14:01:27 -0800 Message-ID: <10bd30c002c9e920e05b539f744be5e9b01c7771.1456178093.git.shli@fb.com> 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 a cgroup share gets shrinked but the cgroup hits its limit, the shrink isn't optimal, we restore its original share. Signed-off-by: Shaohua Li --- block/blk-throttle.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 2271c7e..7db7d8e 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2229,6 +2229,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, sq = &tg->service_queue; +again: tg_check_new_weight(tg); detect_inactive_cg(tg); while (true) { @@ -2238,8 +2239,18 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, tg_update_perf(tg); /* if above limits, break to queue */ - if (!tg_may_dispatch(tg, bio, NULL)) + if (!tg_may_dispatch(tg, bio, NULL)) { + /* + * If the cg hits limit but its share is shrinked, the + * shrink isn't optimal + */ + if (sq->acting_weight < sq->weight) { + /* pretend we are changing weight */ + sq->new_weight = sq->weight; + goto again; + } break; + } /* within limits, let's charge and dispatch directly */ throtl_charge_bio(tg, bio);