Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3817079rwi; Sun, 16 Oct 2022 19:16:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ztoo2m+yNeVSPwN5vLXqFK+jI49o1V/xyXVh9wm7LdXYMOTxrkk0Smr0InS/ENWJwjqfY X-Received: by 2002:a17:907:168c:b0:78d:8b6c:a209 with SMTP id hc12-20020a170907168c00b0078d8b6ca209mr7295060ejc.185.1665972964738; Sun, 16 Oct 2022 19:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972964; cv=none; d=google.com; s=arc-20160816; b=DmVNbSRFforHTKaX5TInSvbT2PQ2tQ54ccYuZxr36KQy+myAnjGMu+qCakwflEIF7X wb+L2ZHwb7k/F7Pufw3Mkaxw3rAeIDc0U+3Z5zReq6IeX/B85OVSxfa9D1el20aAc3ML hBokgGxTXScSD1ycNMxEcrVaA+hbg0xEGc0brxv02M54GCiD8Udu4Uod/RHFcOutV5n5 hQddtRxHQ1/Xyt0elOCqmkNltf9IgUbWCOy9c1p6+bgeovLUtR3IUlpiOfnOiBTXuUj7 VciEAg8ZbM1KVhmNlJJmY7ZW6NWtW4lUtG9SM/kcX9BTpjjAdjh8rgFFTn0xf/Z0y3XK ZYDg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds1-20020a170907724100b0078e18bd3073si8446675ejc.820.2022.10.16.19.15.39; Sun, 16 Oct 2022 19:16:04 -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 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 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 --- 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; -- 2.30.0