Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3807646rwi; Sun, 16 Oct 2022 19:03:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gE9KKJ6vrH8QC/FAbcpFkyI4FRoyXdlEYd2iKKOlinVYO3w7vrlElQ77gsO5U7GsNBqj6 X-Received: by 2002:a17:902:e5d1:b0:183:6e51:4ff with SMTP id u17-20020a170902e5d100b001836e5104ffmr9420099plf.151.1665972220803; Sun, 16 Oct 2022 19:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972220; cv=none; d=google.com; s=arc-20160816; b=R4EPaflavrWo74bq1PDJATf07V1fCpB1MDAAOvaVAktYeCsSN5vbbHUn7WSxZ4OwEz fnrjw75ByCv2riD/UDeeb936KbHtQ/F3bED44o5Y8bTsLTtaEhKJsWRO10bOsvykJoNr oxTUUwpDQIFsfO6NIKDi0OeKOzRDzQn/B51+ZGV5h8q1RJebFBh6mBSu3L4AfmSmtD0k idFeBKh95hcdK5BvF3i6hLfWf5bRWaMil9mbrivF3FYi4M6IyqMhZzGM8aowYKPspb/o SOgDR4xyrhJBXDq98RXqRrcBy1qev1Zg69vM03dcKOQTVkwiop9szD/shq5ZFsaTEZ2D 4WAA== 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=x8hC91BZ5NTGEPosqY03RU642OsBOcX2WbA5dKY/Ik4=; b=M31GbkzqoL2alYxD7JpNvgDhEYejFcbN86cvqrsqIX/Mfz3pT7xkMouvlxA8CtdniA 2mNIO4xA8QsvVPOmA1BmQSy33uFHC546ad76veyfNR3k74W/MrmpR9KEyKK2bQ+3/WLb E/qggU2sywRBd/KIfT/ae2b43SwbmAawxeRmWrGU8+lXhrMzJBL4ZLot6ljxDkEGxBIE Or0+v864M7zn84yCbedi37X2YFPA7sCQ3ZEmPiAMpqqEaz8gMSiHg3NLEYc38hlS9RNo U+ucjrE3+Kz8cKZ7+XdV29TH/KEYye7kR3K+rsia1h9ASkP8pY9N56pR3z85o8O9rA4l 85pg== 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 k7-20020a635a47000000b00457f36aba6esi9000568pgm.531.2022.10.16.19.03.28; Sun, 16 Oct 2022 19:03:40 -0700 (PDT) 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 S230135AbiJQCAr (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbiJQCAV (ORCPT ); Sun, 16 Oct 2022 22:00:21 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1817F26101; Sun, 16 Oct 2022 19:00:21 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MrKqg1lPtzpW9D; Mon, 17 Oct 2022 09:57:03 +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; Mon, 17 Oct 2022 10:00:18 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 8/8] blk-iocost: Get ioc_now inside weight_updated Date: Mon, 17 Oct 2022 10:00:11 +0800 Message-ID: <20221017020011.25016-9-shikemeng@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20221017020011.25016-1-shikemeng@huawei.com> References: <20221017020011.25016-1-shikemeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.178.129] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 The ioc_now parameter of weight_updated is only needed if we need call propagate_weights. Move ioc_now inside weight_updated to remove unnecessary get of ioc_now from outside of weight_updated. Signed-off-by: Kemeng Shi --- block/blk-iocost.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 4815e676733d..e2aaf133deb8 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1220,18 +1220,21 @@ static u32 current_hweight_max(struct ioc_gq *iocg) return max_t(u32, hwm, 1); } -static void weight_updated(struct ioc_gq *iocg, struct ioc_now *now) +static void weight_updated(struct ioc_gq *iocg) { struct ioc *ioc = iocg->ioc; struct blkcg_gq *blkg = iocg_to_blkg(iocg); struct ioc_cgrp *iocc = blkcg_to_iocc(blkg->blkcg); + struct ioc_now now; u32 weight; lockdep_assert_held(&ioc->lock); weight = iocg->cfg_weight ?: iocc->dfl_weight; - if (weight != iocg->weight && iocg->active) - propagate_weights(iocg, weight, iocg->inuse, true, now); + if (weight != iocg->weight && iocg->active) { + ioc_now(iocg->ioc, &now); + propagate_weights(iocg, weight, iocg->inuse, true, &now); + } iocg->weight = weight; } @@ -2968,7 +2971,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd) } spin_lock_irqsave(&ioc->lock, flags); - weight_updated(iocg, NULL); + weight_updated(iocg); spin_unlock_irqrestore(&ioc->lock, flags); } @@ -3053,7 +3056,6 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, struct blkcg *blkcg = css_to_blkcg(of_css(of)); struct ioc_cgrp *iocc = blkcg_to_iocc(blkcg); struct blkg_conf_ctx ctx; - struct ioc_now now; struct ioc_gq *iocg; u32 v; int ret; @@ -3074,8 +3076,7 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, if (iocg) { spin_lock(&iocg->ioc->lock); - ioc_now(iocg->ioc, &now); - weight_updated(iocg, &now); + weight_updated(iocg); spin_unlock(&iocg->ioc->lock); } } @@ -3101,8 +3102,7 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, spin_lock(&iocg->ioc->lock); iocg->cfg_weight = v * WEIGHT_ONE; - ioc_now(iocg->ioc, &now); - weight_updated(iocg, &now); + weight_updated(iocg); spin_unlock(&iocg->ioc->lock); blkg_conf_finish(&ctx); -- 2.30.0