From patchwork Wed Nov 23 06:03:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 24720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2617410wrr; Tue, 22 Nov 2022 22:13:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tOSiK0yy6UawSuGZcxihgkR9DYSyktO7ey/IYBKvAHP+2c2cqSfIhpD358mgRI17M6n09 X-Received: by 2002:a17:90b:3444:b0:214:e1:cabe with SMTP id lj4-20020a17090b344400b0021400e1cabemr7182740pjb.153.1669184024998; Tue, 22 Nov 2022 22:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669184024; cv=none; d=google.com; s=arc-20160816; b=JLLzZR0y1WXwjQSR8lNvg5P6e9qJkRavQBJEr8J7O0Wm/H5/+pRAdumazWX5HYBVTO kB1bDMfRASiRBzCW10VC82gcGzo+4kgbDBEiGRZZM0HWbZKv5IujWfvMZGuAD6m1gEsp xzDAdL53jjkXyBaXwCEQrjD7Rhd4WVSIUVPsgZ6GFIehDiDdv9CurKfO49gjCl8zP6Rr qTieqwGDvzvhJ3sJIn9zZCnqu6Q3agILoHRjg6aadHzlnZk/eyN+ZBPjy9txfIsOs6YI fido/KjJMI+Pf64IAClDeAIrFSEsTdHVQCBk/AQ5ZnQAdfL6BOWax86RKCT3s/sSrKp0 2EgA== 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=3a2RkVfiDxYzQmdktFA6615MgVSMHHm+hBhNcYIQhx0=; b=O/ZcTJ0NqwJ163cO9EE/gQ1Ma02u2dlTu7N+azHlGzf4Fn5yjNJx20HkZL10yHVtkF /JPIFiRJhTPw5hNM/knhw5QM0qFfhRlZuVRKx9F9p86y8Uhro7JF0TyHTmBB/V4X5VsO YFZKnhCdXJx/owcoybzi/O1OK+mhkaaxL0JRV1Z18HpTOqknx3XlCjPrHlzNpcK+a9gr bk67EzM1hNXHukgfe1SwfW1E52A5/SA11bb4QPhUKF0OrETbond8VmpNr2cAjuItY2ec gizOxp7G1WuQJ5C9gIM61ifCuLm5bLbM8t6fbEYPyZVe1iE+/bbxre2k7LY984IRIjNC FQmQ== 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 c13-20020a170903234d00b0016da027a727si17553789plh.116.2022.11.22.22.13.31; Tue, 22 Nov 2022 22:13:44 -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 S235941AbiKWGEy (ORCPT + 99 others); Wed, 23 Nov 2022 01:04:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235777AbiKWGEN (ORCPT ); Wed, 23 Nov 2022 01:04:13 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE56F2C0A; Tue, 22 Nov 2022 22:04:12 -0800 (PST) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NH9Y73f6LzmW7J; Wed, 23 Nov 2022 14:03:39 +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:10 +0800 From: Kemeng Shi To: , , CC: , , , Subject: [PATCH 09/11] blk-throttle: remove unnecessary check for validation of limit index Date: Wed, 23 Nov 2022 14:03:59 +0800 Message-ID: <20221123060401.20392-10-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750266308286906706?= X-GMAIL-MSGID: =?utf-8?q?1750266308286906706?= We always keep limit index valid as following: Max limit is always valid and low limit can only be invalidated in blk_throtl_update_limit_valid. Each time low limit may become invalid after blk_throtl_update_limit_valid is called, we will check and make sure current limit index is valid. It's reasonable to always keep limit index valid, so we can remove this check. Signed-off-by: Kemeng Shi --- block/blk-throttle.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 3eccc7af4368..6f509cadd92b 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -418,12 +418,10 @@ static void tg_update_has_rules(struct throtl_grp *tg) for (rw = READ; rw <= WRITE; rw++) { tg->has_rules_iops[rw] = (parent_tg && parent_tg->has_rules_iops[rw]) || - (td->limit_valid[td->limit_index] && - tg_iops_limit(tg, rw) != UINT_MAX); + (tg_iops_limit(tg, rw) != UINT_MAX); tg->has_rules_bps[rw] = (parent_tg && parent_tg->has_rules_bps[rw]) || - (td->limit_valid[td->limit_index] && - (tg_bps_limit(tg, rw) != U64_MAX)); + (tg_bps_limit(tg, rw) != U64_MAX); } }