From patchwork Tue Oct 18 12:19:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 4148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1930973wrs; Tue, 18 Oct 2022 05:25:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59qYgdSl4Mxdjx1TeBNbev4tUl/FUlN2MWhMW4WDlgDYEjSVB88FfdCNqXBijFCPXsS4Fz X-Received: by 2002:a17:906:844f:b0:78d:8bd1:ee8c with SMTP id e15-20020a170906844f00b0078d8bd1ee8cmr2266787ejy.262.1666095914542; Tue, 18 Oct 2022 05:25:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666095914; cv=none; d=google.com; s=arc-20160816; b=zAqzbqrg7xn/WXXlm0YZmZ8TxHFh1jvsivbTp/Eaz5cF4IM8Mlk6UNjDT58tRui/Nk T4lVeaS0WvOdR/9nZz3iFV8oj6DM1gx7W/R3lK6Zh77us+FHf5sxH7cajYa9QbfypN6H qUcvXr0YEoBiwUloNE3YCbCxFyqe0sRhv1N84SG91VqbMLMA7R+qdgh2c6x1w9TxD6pi RnVa0dQplCbcETDWPQ1b1owDjSGyuYc/uP1hJW9nEUuVuYxI6sNAMr2w6Eof1PWlzAxc nqyMFfjwZak2i5SV2zCVxAni8CtoEaN6MU1D/n8/Cx6MPjdUJcHutKwnkb97ngGuVBb6 1stQ== 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 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.24.48; Tue, 18 Oct 2022 05:25: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 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747028189737813995?= X-GMAIL-MSGID: =?utf-8?q?1747028189737813995?= 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];