From patchwork Mon Oct 17 02:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1227817wrs; Sun, 16 Oct 2022 19:01:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6whUoHbPd/FJKcguW7QEKNzDfoDdQmVT46LURoPGHCnBkejGMKAIfqegf2DzJOujKLWTh9 X-Received: by 2002:a63:f206:0:b0:446:eb31:47e0 with SMTP id v6-20020a63f206000000b00446eb3147e0mr8710912pgh.491.1665972099432; Sun, 16 Oct 2022 19:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972099; cv=none; d=google.com; s=arc-20160816; b=izhEt3leY++hOg0Iq3Tp94ZVVEhLPJ9w6FKhcUpcxysPmMyFyVedrTsjJZ37+l6zI5 8UIBrVDUcWSmoFHXfZckI/nZc1PsAqpbsODBO+2bYtF3y8guoVKyGNySYzVQZMrwF5iM Cp5/3Wm0eNDeTUv2vEMJCQNhWokANxHmUQ2141R/Nuw9vm2FJcyT4ZYeMbYb2jFEWB71 hXQ/Eor9ayd81XRWEVy/5nsJInMvyrNEGIuxkDKT7dovBdFn8voaFggpf7jS/eMNzpOF rhTFfZJ2gODUBwuH+eSlN6flFe15MqLMrSlhUvs2yV6J/tIJJFUWS/wDyYcInVJfuSpm IlMQ== 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=IDFgAK+iJ8AMaPlMabp6u0Ymv48SGwkd125rKAClGwo=; b=LEfgZPzcb4xE7BEsC7DS1e2ixcfu1bRWvIDKz9xp3ilA7Ch18dyng2zrF4n+9YrmN8 eCTgVblPoM3M3cGKpf51Dhcx+X1GUT8JIBxxXNc7Jl5G6/fxgZ+EG3IjRDxdzYUQZdom RnDMf5xSG5bz25/LXSviPsyC8Qh/xzZ0TJeRRK7nPripazfPodj0owrCS/YtSe9Wwz21 vB5IjQF0mHgFW8XCOk6vXpNTSZA7bvqqc0JzvQGDZsudzUoQcJwcnDamQKjOxMQc0LwG FbadTvv1zv/vPD9xQuJCK/hH3/WS6Zx0LABnVdmN8yGSW4BTq125IneJDOY6OkJgDpwv xtNA== 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 n15-20020a170902e54f00b00176db576db9si12456314plf.275.2022.10.16.19.01.25; Sun, 16 Oct 2022 19:01:39 -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 S229900AbiJQCA2 (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbiJQCAS (ORCPT ); Sun, 16 Oct 2022 22:00:18 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D874324F2D; Sun, 16 Oct 2022 19:00:17 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MrKny6ypvz1P7m7; Mon, 17 Oct 2022 09:55:34 +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:14 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 2/8] blk-iocost: Reset vtime_base_rate in ioc_refresh_params Date: Mon, 17 Oct 2022 10:00:05 +0800 Message-ID: <20221017020011.25016-3-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?1746898359964342185?= X-GMAIL-MSGID: =?utf-8?q?1746898359964342185?= Since commit ac33e91e2daca("blk-iocost: implement vtime loss compensation") split vtime_rate into vtime_rate and vtime_base_rate, we need reset both vtime_base_rate and vtime_rate when device parameters are refreshed. If vtime_base_rate is no reset here, vtime_rate will be overwritten with old vtime_base_rate soon in ioc_refresh_vrate. Signed-off-by: Kemeng Shi Acked-by: Tejun Heo --- block/blk-iocost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index be4bc38821e2..9214733bbc14 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -906,8 +906,10 @@ static bool ioc_refresh_params(struct ioc *ioc, bool force) if (idx == ioc->autop_idx && !force) return false; - if (idx != ioc->autop_idx) + if (idx != ioc->autop_idx) { atomic64_set(&ioc->vtime_rate, VTIME_PER_USEC); + ioc->vtime_base_rate = VTIME_PER_USEC; + } ioc->autop_idx = idx; ioc->autop_too_fast_at = 0;