Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5869614rwi; Tue, 18 Oct 2022 05:24:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4taY4xhyCGzbt7wkwqx2f8GwsS2oulTR+JasXPYfcUWhpD8v2Gg7n+f9A4fPl9FV3mUFUT X-Received: by 2002:a17:907:c15:b0:78d:af58:4274 with SMTP id ga21-20020a1709070c1500b0078daf584274mr2229055ejc.150.1666095859867; Tue, 18 Oct 2022 05:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666095859; cv=none; d=google.com; s=arc-20160816; b=v08NxxG8siaKTIRZ+7SrbkK5ZauUpKDUeWA6PKsXpRpaQdgMhTclYm2mJ80Ua3E0Dx KjkqovJGervHbv3c19YOyMqQrIt7JkL5/m+Ea3oCKruQuMfv5vqkJcZRalG/w2ZTJbzR cGAtWdGHGyqTNgA7pxckMhJpKX4eqiBtgT3vnhnOJlPKy3w8mWQWkFuTqB97Eq6MbNqg VQyNT1c8GhgkWzx/5jJUpZvQxfQoCHKfGVPE8FnrnKZvKtgVqr0MzKNUEjfZF6mjuApI bu6t9TP3KoxjVAVv26LUKzc7k1ysaZHNiwbiVjEIvdBAI+QghWDaymltEfwyeEiAXxnA ocSw== 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=nOnSqj4i6hWGqcxuGP1U1QHsspOlohll2Voy5RQSWfI=; b=rPIvaOlqoBT0G5xqXvKqQqaq+F8Vcup+pepMq0sqcr+XC99XxFE1tW1LjO4omeUDWO EgvnxecbkwhhJDjKzTUR2qRZ1PzIIjY8kviifWOho1K+8OzVRGvX8/x9Cx/9L+IUkJJF Nsjsk3VJFD79WqYtsKmZrBxvb9VRuKB4gG8sWxjos94qmL6MnD+nA87eJywTwc41I2Et 5jVZAQGTc2YqYiIx7bUSY/cZTrrFV7PY/npWai9m4l7maEizET/qINy1x19RG3n2TmDD +oMfZ0owGDZ64t1w8OoV8pQ9r19r8EX5NdWBsexqd8S3zDP+N2Os9zMiSc84mVhWo7h2 by6w== 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 s21-20020a056402015500b00458a650f3fasi10217628edu.409.2022.10.18.05.23.53; Tue, 18 Oct 2022 05:24:19 -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 S229773AbiJRMTt (ORCPT + 99 others); Tue, 18 Oct 2022 08:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbiJRMTn (ORCPT ); Tue, 18 Oct 2022 08:19:43 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4F242E6; Tue, 18 Oct 2022 05:19:38 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MsCbQ0hRbzHtx3; Tue, 18 Oct 2022 20:19:30 +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; Tue, 18 Oct 2022 20:19:35 +0800 From: Kemeng Shi To: , , CC: , , , Subject: [PATCH v2 2/5] blk-iocost: Reset vtime_base_rate in ioc_refresh_params Date: Tue, 18 Oct 2022 20:19:29 +0800 Message-ID: <20221018121932.10792-3-shikemeng@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20221018121932.10792-1-shikemeng@huawei.com> References: <20221018121932.10792-1-shikemeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.178.129] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 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; -- 2.30.0