From patchwork Mon Oct 17 02:00:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1227913wrs; Sun, 16 Oct 2022 19:01:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bYVXmPn0+rSKRxs6egZ6kCQUHPzN7OXetOEZZnF3NAy1bhluWkDtfZRsCstNKinn0Tcv2 X-Received: by 2002:a17:902:d54d:b0:17f:6303:f3e with SMTP id z13-20020a170902d54d00b0017f63030f3emr9574026plf.159.1665972112175; Sun, 16 Oct 2022 19:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972112; cv=none; d=google.com; s=arc-20160816; b=x+RNZxIvYSjWRDwkQ7l0wNWVPmqBeZqUjBddhiGgYms+blJEgLodCzWvRIlJLd589z xmm+NZR3ODu00FBgaVUnsV8ZtAvK4/iosf9zPQ7AocH/gn0r0oSZffmywC1Qkum6Aay1 3Dn3KVRGFpqjs6ca8nuY222FpBz+XY717dvhYkOFnVci2hx+yU8cLrEhIJHGc7/EubMH Fc3DPWQB0g++amCTcaaL8I3PMpy9Nb1qaVh8B/NiVhfNrYPuaUv2ADffPGvMHWkc7s/V x6WH4W7LQiIbLEUcj9aAiRmQDCUtA5t5blXXLCh1m+M1dLJosex1212l4Tx/1X1Ru5y+ 7Ttw== 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=jTWVuTItJIaeg5jSo8MY+uWkviM7Xk1RDMRE2xuXknA=; b=GYgEP1HMf5Hq91m+vu54/rcAI4DjuxC6s9+A66RsUkareanrOkX2nBDRIfDJbB8w+4 QQnSTsTEQ7e1WCQSqSYDA9NYGnViKJ6RHiQq4TP/vwtQsCY2nYrjuBtduqHnyNSf5PbL ckG099vxYM8Scn4QXOhkNtuq8xRUFpwTFuttkz7CGnaDBEYazrkok/sU8Gjafb89KAFA JE3HhwPhtpMZ3UG6Jc6lmppHYCm4a9ghddbNN6YDV7IvOCl1+4qUeu7GwRw/fbC3jGkH HE3jUydX355eoZ5OigA/pY34+nxCYfvQ+xjR4cQ8WhsbyLwD+gBluMoOnU1hozjz3FKH Cr1A== 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 a2-20020a056a000c8200b005657b95c7d9si10909184pfv.348.2022.10.16.19.01.39; Sun, 16 Oct 2022 19:01:52 -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 S229983AbiJQCAZ (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbiJQCAT (ORCPT ); Sun, 16 Oct 2022 22:00:19 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D4DB25C6B; Sun, 16 Oct 2022 19:00:18 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MrKrM38S7zJnTn; Mon, 17 Oct 2022 09:57:39 +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:15 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 3/8] blk-iocost: Trace vtime_base_rate instead of vtime_rate Date: Mon, 17 Oct 2022 10:00:06 +0800 Message-ID: <20221017020011.25016-4-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?1746898373332667282?= X-GMAIL-MSGID: =?utf-8?q?1746898373332667282?= Since commit ac33e91e2daca ("blk-iocost: implement vtime loss compensation") rename original vtime_base to vtime_base_rate and current vtime_base is original vtime_base with compensation. The current rate showed in tracepoint is mixed with vtime_base and vtime_base_rate: 1) In function ioc_adjust_base_vrate, the first trace_iocost_ioc_vrate_adj shows vtime_base, the second trace_iocost_ioc_vrate_adj shows vtime_base_rate. 2) In function iocg_activate shows vtime_base by calling TRACE_IOCG_PATH(iocg_activate... 3) In function ioc_check_iocgs shows vtime_base 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];