From patchwork Mon Oct 17 02:00:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1228446wrs; Sun, 16 Oct 2022 19:03:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70uKm1x8A7dwFfI81PF57JHdhK2jqlwYDCqouLgV+6hDJkU+3PKdo8pZhRTHysgmZHMZ2M X-Received: by 2002:a05:6a00:1907:b0:564:f6be:11fc with SMTP id y7-20020a056a00190700b00564f6be11fcmr9852192pfi.47.1665972194358; Sun, 16 Oct 2022 19:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972194; cv=none; d=google.com; s=arc-20160816; b=Qn1uTU3loSQDtfbQ1pBDc6FqrcShMIDSZi8lwn3dVcVz5rrWhrVHrIsZzQsG5Re2jo Q05L0rVwL0MiVRYZ/jYlv3orLTYi21Or2KgSlET8h0KSwN+m3YnpouhhS6Z1OyyL+y0f pX6SF9ccTTipdMX0ogjji3CmALSRahMLwKPoirxwXSiUsKEbt8lgBPyzWeiJv0gKeJ+v 9wN9o3Jo7SzaKkI6XZY33bkDYz/K9gJ7ezn+2jZ0HwM2Qhqt5y+N0TFVsVAfRPfXE4tC DsXfSZ8oNn4bgvER0n3GI2A2HD/C7gGqTmqlljKBNznMuqP2ReE+jRjwImuVcEtJdrls xfLQ== 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 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.02; Sun, 16 Oct 2022 19:03:14 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746898459706889687?= X-GMAIL-MSGID: =?utf-8?q?1746898459706889687?= 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);