From patchwork Mon Jan 22 01:17:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 10177185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C92A2601D5 for ; Mon, 22 Jan 2018 01:17:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB05820223 for ; Mon, 22 Jan 2018 01:17:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFBBC205AF; Mon, 22 Jan 2018 01:17:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900F220223 for ; Mon, 22 Jan 2018 01:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751047AbeAVBRq (ORCPT ); Sun, 21 Jan 2018 20:17:46 -0500 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:56335 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751031AbeAVBRp (ORCPT ); Sun, 21 Jan 2018 20:17:45 -0500 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.08722539|-1; CH=green; FP=0|0|0|0|0|-1|-1|-1; HT=e01e07486; MF=joseph.qi@linux.alibaba.com; NM=1; PH=DS; RN=5; RT=5; SR=0; TI=SMTPD_---0SwxsPEh_1516583861; Received: from JosephdeMacBook-Pro.local(mailfrom:joseph.qi@linux.alibaba.com fp:42.120.74.105) by smtp.aliyun-inc.com(127.0.0.1); Mon, 22 Jan 2018 09:17:41 +0800 From: Joseph Qi Subject: [PATCH RESEND 2/3] blk-throttle: support only configure leaf nodes To: Jens Axboe , Shaohua Li Cc: jiufei.xue@linux.alibaba.com, caspar@linux.alibaba.com, linux-block Message-ID: Date: Mon, 22 Jan 2018 09:17:42 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Language: en-US Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently if we only configure leaf nodes, downgrade check won't function properly as parent's last low overflow time is meaningless and always returns now, thus it will be treated always run above low limit and doesn't have to do downgrade. In this case, since parent doesn't have low limit, ignore checking it and just depend on child's decision. Note that we do not support only configure intermediate nodes. Signed-off-by: Joseph Qi Reviewed-by: Jiufei Xue --- block/blk-throttle.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index a0bae2c..9c0b5ff 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1959,6 +1959,15 @@ static bool throtl_tg_can_downgrade(struct throtl_grp *tg) unsigned long now = jiffies; /* + * If parent doesn't have low limit, only consider child's + * decision. + */ + if (!list_empty(&tg_to_blkg(tg)->blkcg->css.children) && + !tg->bps[READ][LIMIT_LOW] && !tg->bps[WRITE][LIMIT_LOW] && + !tg->iops[READ][LIMIT_LOW] && !tg->iops[WRITE][LIMIT_LOW]) + return true; + + /* * If cgroup is below low limit, consider downgrade and throttle other * cgroups */