[08/11] blk-throttle: remove repeat check of elapsed time from last upgrade in throtl_hierarchy_can_downgrade
Message ID | 20221123060401.20392-9-shikemeng@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2617696wrr; Tue, 22 Nov 2022 22:14:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Eam0ZY0ECbPutXUpfTDZtcIcA3pvb3hNL4dpFqucpseyYer71Q/qz+c7XKMDa3fykPTKP X-Received: by 2002:a63:fa45:0:b0:476:e63a:99b6 with SMTP id g5-20020a63fa45000000b00476e63a99b6mr9755595pgk.60.1669184089673; Tue, 22 Nov 2022 22:14:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669184089; cv=none; d=google.com; s=arc-20160816; b=i0jxsbJ7XRgsaZwRUNNTf/xyizJaYut71PffGd8Svx45oD6rJ6JjqKYMLfNV3jhAkM 61oqobI5TVgUobyeVWHPmaM47EPY0VRwIsnvkCbwRTf34xxq97juJlNTDuoky/o77cqJ QHhOR15dQQN4ZS8rcUsiZ8NtEPtEuJzby6TR6qQt3993LIkasIXsJWLIYaTSuNQU51i3 pagiCmWwU5OXVFT9qhPQkXcO/Yx8TtysxVS6DxYaEQUqZc8HEW06IlVqeKwA7qnmVHDr NGNMXv1a4M3SDulSWY/7iG+ko5g8hgRL1lMCkJheduVjZ66YqF/BcpPwpZQncVa9Vsph CKAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=KOpk+qo/jiL3mD9ORxM3SXeURwL2x7Dis2yse1MWqnk=; b=DGP+8C5jKLadHb/JDzo1QmfRg/ucEJPL8rP4v6Ij4gczqE1ZP5eimLvw7KWSHk8eAL GtvFh1x+eo8jMPV3OJVqBbkVZ0Ca0P9vG8ZaLqgdua4mba6dmRjqm1ABpA/BKlwy007w /XmqOS2ck+86G9lUMr3P5vIDcKIZpVolsXXrgCl1vHdPG3oORnu3KbaaNwBAHohwMohJ 7taAEDmDFq28MLNfx/4bSP/J9ZDjm1yK4psD50sMEBAtUmHwWiXkLn5YXXMsBfHAEgfY cJrFOfPhBlX64sFUe81c9ipt8RdpnNEBjb3mWciTslK9NFhgkdSaf2eYvxzWBIp/T6aA flMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a6553c2000000b0047787372364si5810311pgr.363.2022.11.22.22.14.36; Tue, 22 Nov 2022 22:14:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235911AbiKWGEs (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Wed, 23 Nov 2022 01:04:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235751AbiKWGEM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 23 Nov 2022 01:04:12 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 468FE729A9; Tue, 22 Nov 2022 22:04:12 -0800 (PST) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NH9Y669zwzmW7F; Wed, 23 Nov 2022 14:03:38 +0800 (CST) Received: from huawei.com (10.174.178.129) by kwepemi500016.china.huawei.com (7.221.188.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 23 Nov 2022 14:04:09 +0800 From: Kemeng Shi <shikemeng@huawei.com> To: <tj@kernel.org>, <josef@toxicpanda.com>, <axboe@kernel.dk> CC: <cgroups@vger.kernel.org>, <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <shikemeng@huawei.com> Subject: [PATCH 08/11] blk-throttle: remove repeat check of elapsed time from last upgrade in throtl_hierarchy_can_downgrade Date: Wed, 23 Nov 2022 14:03:58 +0800 Message-ID: <20221123060401.20392-9-shikemeng@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20221123060401.20392-1-shikemeng@huawei.com> References: <20221123060401.20392-1-shikemeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.178.129] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500016.china.huawei.com (7.221.188.220) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750266376000642468?= X-GMAIL-MSGID: =?utf-8?q?1750266376000642468?= |
Series |
A few bugfix and cleanup patches for blk-throttle
|
|
Commit Message
Kemeng Shi
Nov. 23, 2022, 6:03 a.m. UTC
There is no need to check elapsed time from last upgrade for each node in
hierarchy. Move this check before traversing as throtl_can_upgrade do
to remove repeat check.
Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
---
block/blk-throttle.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
On Wed, Nov 23, 2022 at 02:03:58PM +0800, Kemeng Shi wrote: > static bool throtl_hierarchy_can_downgrade(struct throtl_grp *tg) > { > + if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) > + return false; Does this even build? Where is td defined?
on 11/24/2022 2:28 AM, Tejun Heo wrote: > On Wed, Nov 23, 2022 at 02:03:58PM +0800, Kemeng Shi wrote: >> static bool throtl_hierarchy_can_downgrade(struct throtl_grp *tg) >> { >> + if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) >> + return false; > > Does this even build? Where is td defined? Sorry for this mistake, CONFIG_BLK_DEV_THROTTLING_LOW seems not be set on default. I will fix this and build with CONFIG_BLK_DEV_THROTTLING_LOW set.
Hi Kemeng, Thank you for the patch! Yet something to improve: [auto build test ERROR on axboe-block/for-next] [also build test ERROR on linus/master v6.1-rc6 next-20221125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Kemeng-Shi/A-few-bugfix-and-cleanup-patches-for-blk-throttle/20221123-140704 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/r/20221123060401.20392-9-shikemeng%40huawei.com patch subject: [PATCH 08/11] blk-throttle: remove repeat check of elapsed time from last upgrade in throtl_hierarchy_can_downgrade config: x86_64-randconfig-a005 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/f01c7d5bc75515a315dff091b1b1aa1ea1ef12fc git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Kemeng-Shi/A-few-bugfix-and-cleanup-patches-for-blk-throttle/20221123-140704 git checkout f01c7d5bc75515a315dff091b1b1aa1ea1ef12fc # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): block/blk-throttle.c:1812:1: error: expected identifier } ^ >> block/blk-throttle.c:1945:50: error: use of undeclared identifier 'td' if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) ^ >> block/blk-throttle.c:1945:18: error: use of undeclared identifier 'now' if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) ^ >> block/blk-throttle.c:1945:18: error: use of undeclared identifier 'now' >> block/blk-throttle.c:1945:50: error: use of undeclared identifier 'td' if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) ^ 5 errors generated. vim +/td +1945 block/blk-throttle.c 1942 1943 static bool throtl_hierarchy_can_downgrade(struct throtl_grp *tg) 1944 { > 1945 if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) 1946 return false; 1947 1948 while (true) { 1949 if (!throtl_tg_can_downgrade(tg)) 1950 return false; 1951 tg = sq_to_tg(tg->service_queue.parent_sq); 1952 if (!tg || !tg_to_blkg(tg)->parent) 1953 break; 1954 } 1955 return true; 1956 } 1957
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index bd07f562c799..3eccc7af4368 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1932,8 +1932,7 @@ static bool throtl_tg_can_downgrade(struct throtl_grp *tg) * If cgroup is below low limit, consider downgrade and throttle other * cgroups */ - if (time_after_eq(now, td->low_upgrade_time + td->throtl_slice) && - time_after_eq(now, tg_last_low_overflow_time(tg) + + if (time_after_eq(now, tg_last_low_overflow_time(tg) + td->throtl_slice) && (!throtl_tg_is_idle(tg) || !list_empty(&tg_to_blkg(tg)->blkcg->css.children))) @@ -1943,6 +1942,9 @@ static bool throtl_tg_can_downgrade(struct throtl_grp *tg) static bool throtl_hierarchy_can_downgrade(struct throtl_grp *tg) { + if (time_before(now, tg->td->low_upgrade_time + td->throtl_slice)) + return false; + while (true) { if (!throtl_tg_can_downgrade(tg)) return false;