Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp216772rwb; Mon, 28 Nov 2022 19:35:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf6YBNyIX240R1I4GmEdJS5z2TvEJCwd2P17LhPUIGemHhF4RCyOSE8gQQ5nyaIHa2zLvlzH X-Received: by 2002:aa7:8a11:0:b0:574:e5aa:a8e1 with SMTP id m17-20020aa78a11000000b00574e5aaa8e1mr14903852pfa.40.1669692943303; Mon, 28 Nov 2022 19:35:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669692943; cv=none; d=google.com; s=arc-20160816; b=NaiaXVFrNj7SwsJkjNAprtEoqO8DkKB1dVw/0d3NMvit6+h0hR9uWKgbOPIXusArBm TO/k4kA5wkX8aP/sIxKHP70zZCCHbeR0RdBS066f9x3NumuG2jHfwD98dHDRkOJmd3hq KN1VDyTbH+ug493buNPpnBcP/IAsEKE5MdzqBLSqM9Hw8/iQzID7SobJws80RgphQUt0 swuwF3xl9O18Zpnxa8wunvDPF8NKZLmriCgLtzuqwEx8uAePaGcobasdVweu4we2UgQ4 BbpPg1VnbvBOePo03YTQ2lcEbnHUnH5kYAGcaw/97JR9d9OvGzYHUix5q1b6R9/HNUq2 Rdgw== 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=Sgb5hCQxnlKQLn/+H8RvdoH8SP0Qae/o0cU1WMxBTcw=; b=S8c4I82FcrHB5eI4ju2jTJTwiWlFwhUrOhp4+HU91lJdL2Cm+C/32Fx4O9FrJo1CRO ziWkM8xOWUQZ+upqTrJxZWVkeZlzFiePbJNcxtuMKowYcP6T5+fhv4LfXb3A/XVWY4jO FLE6h84GIalfzTX0XdctFQwn5E7G3Kil+rqfn9dOwWWgqnBzEKozoyNQZfMJl068c/D9 HWIU/MUKYtVVQOOX+gCJGeKnXLpLWGlaFrcIftjGWYzbjPXw66W32pBrXwZcA+VI/fuF xelVPXNNHYTqBwsC4YrjF7sVUODji0wgj1UQfmYMtgSBG6OBHgNXvaNmnk7zR22LDkMj vB3Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a056a00134300b0056ee105315fsi13027355pfu.178.2022.11.28.19.35.32; Mon, 28 Nov 2022 19:35:43 -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 S235399AbiK2DC3 (ORCPT + 82 others); Mon, 28 Nov 2022 22:02:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235313AbiK2DB6 (ORCPT ); Mon, 28 Nov 2022 22:01:58 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB6C45097; Mon, 28 Nov 2022 19:01:57 -0800 (PST) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NLnCx4dyFz15Mxq; Tue, 29 Nov 2022 11:01:17 +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; Tue, 29 Nov 2022 11:01:55 +0800 From: Kemeng Shi To: , , CC: , , , Subject: [PATCH v2 08/10] blk-throttle: remove repeat check of elapsed time from last upgrade in throtl_hierarchy_can_downgrade Date: Tue, 29 Nov 2022 11:01:45 +0800 Message-ID: <20221129030147.27400-9-shikemeng@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20221129030147.27400-1-shikemeng@huawei.com> References: <20221129030147.27400-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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reported-by: kernel test robot --- block/blk-throttle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 3ddd8a15aa3f..94d850b57462 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1955,8 +1955,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))) @@ -1966,6 +1965,11 @@ static bool throtl_tg_can_downgrade(struct throtl_grp *tg) static bool throtl_hierarchy_can_downgrade(struct throtl_grp *tg) { + struct throtl_data *td = tg->td; + + if (time_before(jiffies, td->low_upgrade_time + td->throtl_slice)) + return false; + while (true) { if (!throtl_tg_can_downgrade(tg)) return false; -- 2.30.0