Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5871797rwi; Tue, 18 Oct 2022 05:26:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+55+hQghwhIw7LQzcDZPcVl1yLUwwFLTGYsLj4uv9JrV5pBM9oxXh3BRYGNJn+dJhKF22 X-Received: by 2002:a17:906:cc57:b0:78d:3612:f0e1 with SMTP id mm23-20020a170906cc5700b0078d3612f0e1mr2248666ejb.188.1666095966801; Tue, 18 Oct 2022 05:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666095966; cv=none; d=google.com; s=arc-20160816; b=MnWEp3/LE4UDV+a0744x4rpoEVxDKkRpkrIXBLCafI4LJDWlROMOlfZ9SC8jaU217f eItG8uWNrk42qb6rfW7uwTe6ih0HH20wuzC3anMSAv1zbehTlrbnZx+p/VT5lTI8TYCy p9AzkroQpe45o1wBBtWMCE2qpq8Sqsl+SzkJ2rKjmzKHp5hR6GT38yOY1GpnW/i0kieK gUMceJbelwylAzMNalFXNtCDCxddj+6fcc9tahn1YMd3OWJ+wyPCdT/Q/b2AVtfOiJeW P3+Y76eQlyedj0tuLSbLvG+6yKHp/cLoxSXPdXOn7HP6S/9P42KOZdMXLFDULOqwlJor qnqg== 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=GgrEhbec/30XJXyI4hr9L/8aZkBJgJAZzamD25UANTQ=; b=0UOgWeM28KMaD1sMv9pQfwnlXsjounVYz1Tf9sZ+YKQxgsWoEf4jzjV+ZOwOkbpsjg W/kDa52Xd5Dn0hG/e5xlnng4mTW6sKPAS8I4P6WC6KL86Lx3rUI10ltSngrEZXp9P0Vz lTUzAkspp3ysTNhlORZaEhWAD7fe/++8T4VF/6Za5AfaeX4742hBsxsoXQwdWrhSG+VM w1goYiZtftEGsE41WF9YzYDe23AOxHV2vccpKWH244ld+C2VHGGLHjzsvrM+QrXsKJg7 +DG9tC2ZJ4n20SEO+CKg3fCST2ok8Y6V+ppL0RFu8gBOj+hPrvWbFQ6CnR1zNme7lcae lNFw== 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 sh36-20020a1709076ea400b0078209ff9896si10821739ejc.509.2022.10.18.05.25.40; Tue, 18 Oct 2022 05:26:06 -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 S230016AbiJRMTw (ORCPT + 99 others); Tue, 18 Oct 2022 08:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbiJRMTn (ORCPT ); Tue, 18 Oct 2022 08:19:43 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A55D412AC8; Tue, 18 Oct 2022 05:19:38 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MsCXV5c7RzJn2j; Tue, 18 Oct 2022 20:16:58 +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:36 +0800 From: Kemeng Shi To: , , CC: , , , Subject: [PATCH v2 3/5] blk-iocost: Trace vtime_base_rate instead of vtime_rate Date: Tue, 18 Oct 2022 20:19:30 +0800 Message-ID: <20221018121932.10792-4-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") rename original vtime_rate to vtime_base_rate and current vtime_rate is original vtime_rate with compensation. The current rate showed in tracepoint is mixed with vtime_rate and vtime_base_rate: 1) In function ioc_adjust_base_vrate, the first trace_iocost_ioc_vrate_adj shows vtime_rate, the second trace_iocost_ioc_vrate_adj shows vtime_base_rate. 2) In function iocg_activate shows vtime_rate by calling TRACE_IOCG_PATH(iocg_activate... 3) In function ioc_check_iocgs shows vtime_rate by calling TRACE_IOCG_PATH(iocg_idle... Trace vtime_base_rate instead of vtime_rate as: 1) Before commit ac33e91e2daca ("blk-iocost: implement vtime loss compensation"), the traced rate is without compensation, so still show rate without compensation. 2) The vtime_base_rate is more stable while vtime_rate heavily depends on excess budeget on current period which may change abruptly in next period. Signed-off-by: Kemeng Shi Acked-by: Tejun Heo --- block/blk-iocost.c | 2 +- include/trace/events/iocost.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 9214733bbc14..b0991b52e3dd 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -977,7 +977,7 @@ static void ioc_adjust_base_vrate(struct ioc *ioc, u32 rq_wait_pct, if (!ioc->busy_level || (ioc->busy_level < 0 && nr_lagging)) { if (ioc->busy_level != prev_busy_level || nr_lagging) - trace_iocost_ioc_vrate_adj(ioc, atomic64_read(&ioc->vtime_rate), + trace_iocost_ioc_vrate_adj(ioc, vrate, missed_ppm, rq_wait_pct, nr_lagging, nr_shortages); diff --git a/include/trace/events/iocost.h b/include/trace/events/iocost.h index 6d1626e7a4ce..af8bfed528fc 100644 --- a/include/trace/events/iocost.h +++ b/include/trace/events/iocost.h @@ -38,7 +38,7 @@ DECLARE_EVENT_CLASS(iocost_iocg_state, __assign_str(cgroup, path); __entry->now = now->now; __entry->vnow = now->vnow; - __entry->vrate = now->vrate; + __entry->vrate = iocg->ioc->vtime_base_rate; __entry->last_period = last_period; __entry->cur_period = cur_period; __entry->vtime = vtime; @@ -160,7 +160,7 @@ TRACE_EVENT(iocost_ioc_vrate_adj, TP_fast_assign( __assign_str(devname, ioc_name(ioc)); - __entry->old_vrate = atomic64_read(&ioc->vtime_rate); + __entry->old_vrate = ioc->vtime_base_rate; __entry->new_vrate = new_vrate; __entry->busy_level = ioc->busy_level; __entry->read_missed_ppm = missed_ppm[READ]; -- 2.30.0