From patchwork Mon Oct 17 02:00:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1227935wrs; Sun, 16 Oct 2022 19:01:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68XLi/XoMhSEKSyRrG3YPQahkcx1BYa7wYOHLwK6Ky/q9M8Au2ariMCZBE4ixpEni0A1yN X-Received: by 2002:a05:6a00:14d4:b0:563:9296:f320 with SMTP id w20-20020a056a0014d400b005639296f320mr9813664pfu.27.1665972114680; Sun, 16 Oct 2022 19:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972114; cv=none; d=google.com; s=arc-20160816; b=GejcV1JhOowHZpQ2wUCBK/ED4pF/w28v92EbAhpZU34upBAMtUkhErkTKxzmdxsDxR nmA6NBdlmXRBMGvFmmMccOylZ7FeoWyXPQ9YpFO0MEtGHg7y1uBzXKDOjqc/NdXuziBc SVlLLDzNOuSDOc1kLcJCPXiXoOwspDlDzVr9a5P2Uk2egQlnDYS8F46a6TpVVjg73JpA iWdW1IEZizQrPDJ715gQuayTXf88Dz83SU5lpFYS9E/v0bLnfKnKJPVnx+K0pVdJEqq4 mdUgukGj6QDfaB2Ar3kQwVXJBZr+H81wdOY/MBjxqUHGAlSvwLRzZPcP4QQxmdoU38lR nVkQ== 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=uGDiVc9WRZ5BwBoRlMm14DWxBCjVhhnkzzFK18cNoPc=; b=WOCI10zrsc4UA+8BGeZZkjap5bY1sSw9Qcu4AfddPNKSaYMMuFNvcvV6YPOXHw6j7F mqtdL06jcTrmEMA0XssXfEvlI5aHmYIdcFW8A1h8Nsk+9lSRXd1rrQCGXX/L4S0geOa3 gg+to9gyrUg7NcOL47QhEgjWdrYpX9Unyqkhy1UU0k8PHkw7Qz2SyABDl4XJSjQFYgPL A39DLnNDTHq9lEDLWFiCjp0DvG0LVkpwiSknbAjwmeBF+kg48zOFYqNAYCWMeXBNhHkD GGIzxxN6Sh/yqBcl3rjmosXpQ6qnwt0pLpxq+gD0gyQWBeWj4GkddzwZoL4sIJot9KRS jcjQ== 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 v24-20020aa78518000000b00565c1aaa304si9399644pfn.215.2022.10.16.19.01.42; Sun, 16 Oct 2022 19:01:54 -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 S230078AbiJQCAU (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbiJQCAS (ORCPT ); Sun, 16 Oct 2022 22:00:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4EA925283; Sun, 16 Oct 2022 19:00:16 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MrKqZ75l7zpVlL; Mon, 17 Oct 2022 09:56: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; Mon, 17 Oct 2022 10:00:14 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 1/8] blk-iocost: Fix typo in comment Date: Mon, 17 Oct 2022 10:00:04 +0800 Message-ID: <20221017020011.25016-2-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?1746898376178724999?= X-GMAIL-MSGID: =?utf-8?q?1746898376178724999?= soley -> solely Signed-off-by: Kemeng Shi Acked-by: Tejun Heo --- block/blk-iocost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 495396425bad..be4bc38821e2 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -111,7 +111,7 @@ * busy signal. * * As devices can have deep queues and be unfair in how the queued commands - * are executed, soley depending on rq wait may not result in satisfactory + * are executed, solely depending on rq wait may not result in satisfactory * control quality. For a better control quality, completion latency QoS * parameters can be configured so that the device is considered saturated * if N'th percentile completion latency rises above the set point. From patchwork Mon Oct 17 02:00:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1227817wrs; Sun, 16 Oct 2022 19:01:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6whUoHbPd/FJKcguW7QEKNzDfoDdQmVT46LURoPGHCnBkejGMKAIfqegf2DzJOujKLWTh9 X-Received: by 2002:a63:f206:0:b0:446:eb31:47e0 with SMTP id v6-20020a63f206000000b00446eb3147e0mr8710912pgh.491.1665972099432; Sun, 16 Oct 2022 19:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972099; cv=none; d=google.com; s=arc-20160816; b=izhEt3leY++hOg0Iq3Tp94ZVVEhLPJ9w6FKhcUpcxysPmMyFyVedrTsjJZ37+l6zI5 8UIBrVDUcWSmoFHXfZckI/nZc1PsAqpbsODBO+2bYtF3y8guoVKyGNySYzVQZMrwF5iM Cp5/3Wm0eNDeTUv2vEMJCQNhWokANxHmUQ2141R/Nuw9vm2FJcyT4ZYeMbYb2jFEWB71 hXQ/Eor9ayd81XRWEVy/5nsJInMvyrNEGIuxkDKT7dovBdFn8voaFggpf7jS/eMNzpOF rhTFfZJ2gODUBwuH+eSlN6flFe15MqLMrSlhUvs2yV6J/tIJJFUWS/wDyYcInVJfuSpm IlMQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a170902e54f00b00176db576db9si12456314plf.275.2022.10.16.19.01.25; Sun, 16 Oct 2022 19:01:39 -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 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?1746898359964342185?= X-GMAIL-MSGID: =?utf-8?q?1746898359964342185?= 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; 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]; From patchwork Mon Oct 17 02:00:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1228019wrs; Sun, 16 Oct 2022 19:02:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JuzVg3NDKfg9fO/4HShsiuQqZKqQ8wq2tt85FXWA3rXRzXNWNryFfSSe3mejV8VfIxeMm X-Received: by 2002:a63:2345:0:b0:463:7c74:73b with SMTP id u5-20020a632345000000b004637c74073bmr8768526pgm.39.1665972126681; Sun, 16 Oct 2022 19:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972126; cv=none; d=google.com; s=arc-20160816; b=y/6moLnllbxMHrpRNR1HioVGEs5bs8cOki+RuV++vyc2AkFAveGLu85JrjvjLXDDin VWzy+xc1v7tgF4Recie1pICXu/VjsHEF5WMCSRP2IBO71JYrqgCdk7bXCEFgo7nWftpf q2ZyUd4G8RN3dsgPXVrqxrMRZZ3d2ThmqfzkfvQFoqXIO38uQvDKOEEIb8HCH80LF4uR f33LQs2WSdUuns8Voy5BESaHNlMsGwd9vdnM1/ktJG47y3E+Ci4TBiSBMleAYi1rmymu C0oczzFWZxuBaJyqqR2mdATOSiNTrgG4YZnS6jR6TquglbzSUhrQK2QZD0tBWlY354JH RqNA== 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=ouzrYhc0IBAbtw8TR7OnN+I5LWESwq+ksgSeooE4gj8=; b=clDXkQ08/gScMbVHCOGx6uVf36h+2y0iSTsBNGi5hndQI5sejpSuvk0r5L4Jj0NYkv UOpPxMHiPwGuMrMQM3u9AqqrtvTWmB1q6v3ZoghWfsx2lLidRN5eZ1ppOIi9bFdBND5e OI2otwjOHYIj9TlWjDm3TgaPccj3Bh068gLz3CeEeVBiGji4RB73d28qrpEShU2Bxh+M BzRsL2p+l8L1mtd4oHWfI8IU8WPoZHwWMbYOcHUzZIArOsDpkZaxUaYixLy26Zphk06G adgSViOHgsjiKZX3VgpcLGn4Y0a/FVyV+aG59369NoXY0DHkcC+iKnhQwK7o0DNmr+Gp iivQ== 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 l17-20020a656811000000b0045a2d89c9cfsi10370890pgt.348.2022.10.16.19.01.54; Sun, 16 Oct 2022 19:02: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 S230101AbiJQCAe (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbiJQCAT (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 817FBDE2; Sun, 16 Oct 2022 19:00:18 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MrKrN0RsczJnTv; Mon, 17 Oct 2022 09:57:40 +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:16 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 4/8] blk-iocost: Remove vrate member in struct ioc_now Date: Mon, 17 Oct 2022 10:00:07 +0800 Message-ID: <20221017020011.25016-5-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?1746898388265980288?= X-GMAIL-MSGID: =?utf-8?q?1746898388265980288?= If we trace vtime_base_rate instead of vtime_rate, there is nowhere to access now->vrate except function ioc_now using now->vrate locally. Just clean it. Signed-off-by: Kemeng Shi Acked-by: Tejun Heo --- block/blk-iocost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index b0991b52e3dd..761295ed9c5a 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -556,7 +556,6 @@ struct ioc_now { u64 now_ns; u64 now; u64 vnow; - u64 vrate; }; struct iocg_wait { @@ -1020,10 +1019,11 @@ static void ioc_adjust_base_vrate(struct ioc *ioc, u32 rq_wait_pct, static void ioc_now(struct ioc *ioc, struct ioc_now *now) { unsigned seq; + u64 vrate; now->now_ns = ktime_get(); now->now = ktime_to_us(now->now_ns); - now->vrate = atomic64_read(&ioc->vtime_rate); + vrate = atomic64_read(&ioc->vtime_rate); /* * The current vtime is @@ -1036,7 +1036,7 @@ static void ioc_now(struct ioc *ioc, struct ioc_now *now) do { seq = read_seqcount_begin(&ioc->period_seqcount); now->vnow = ioc->period_at_vtime + - (now->now - ioc->period_at) * now->vrate; + (now->now - ioc->period_at) * vrate; } while (read_seqcount_retry(&ioc->period_seqcount, seq)); } From patchwork Mon Oct 17 02:00:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1227883wrs; Sun, 16 Oct 2022 19:01:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XTFYAmml7Qyu1rZqZg4Ak4ruNrrD4PYN4MW+MfKhlXYG8pNzAiWw3LnNh97WDLR+XowVH X-Received: by 2002:a63:4f09:0:b0:440:4706:2299 with SMTP id d9-20020a634f09000000b0044047062299mr8698474pgb.115.1665972107427; Sun, 16 Oct 2022 19:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972107; cv=none; d=google.com; s=arc-20160816; b=mb5CMqm76JdJYIH/jx7M2b863UrSGuZCpZS4MbMw8km7QOe1e8cBVjD5OEqXw5KfpM f3QJ87ozk4BzilKSyeIZxfQ/Xw2Sklc1cdar6YHTUo8wZSWnikAHBMp2onhfOzZhWKhy VA3Qiun7KshdUCVgyRBShj6r9Zgl0AYK/GhKX1wHLw7C6CWR+nOpyzXXfInPwofHuITi 7tnLHC5pYTb+jzqfH/gvdDX0kPw8eKJ0D2X9KU7ruTfN3FGqeZWA1shgOBNRuiZtAh1T JTIlN8oX/ylKlYG7Dqq/HPG47C+c8zaomcxhc4X3+bzChstvFpSqJVzE+tWbYMPaKtJV 3hgA== 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=uKanzW/VwDYGlwmtj3P1eCv4AASwkrW5OeVn27zLGbc=; b=TzaHh4k6pVP5TsYHkEdy7YIcYW/vAffx/xt5D08z/OCNo5Q93yUJb9/aoaXWBEV/o5 KTozvEd3i0AB9fqinMrJm8g/Orf02Ae8uTJohSKLhn8eVM/WcRuvItwYKknVZTeSetNv g14D5JQebFhHc+xqfhH8nyqygJQFKXGY/j8bI2s5P9Mm6tbsGmTDTst0yo2ydZNxXs81 DxVvq2KnOuCR43GmqOLiEojuFZzDO6tMU2yFdNiQFAak9FSGeDIPpCuCRn/LQD/KrDZv TyDkeAXYOp8PWULO6ok0iN0bYgGOwnr0MhOJXSHhSJIx7oJWxzJf+EI2L+bXQiPvo9AF LmDg== 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 v20-20020a056a00149400b00554f1b32131si11112028pfu.362.2022.10.16.19.01.35; Sun, 16 Oct 2022 19:01:47 -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 S230112AbiJQCAi (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbiJQCAU (ORCPT ); Sun, 16 Oct 2022 22:00:20 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 238E326101; Sun, 16 Oct 2022 19:00:19 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MrKrN4WlhzJnTs; Mon, 17 Oct 2022 09:57:40 +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:16 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 5/8] blk-iocost: Correct comment in blk_iocost_init Date: Mon, 17 Oct 2022 10:00:08 +0800 Message-ID: <20221017020011.25016-6-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?1746898368660576250?= X-GMAIL-MSGID: =?utf-8?q?1746898368660576250?= There is no iocg_pd_init function. The pd_alloc_fn function pointer of iocost policy is set with ioc_pd_init. Just correct it. Signed-off-by: Kemeng Shi Acked-by: Tejun Heo --- block/blk-iocost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 761295ed9c5a..96c1571a8a1d 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2880,7 +2880,7 @@ static int blk_iocost_init(struct gendisk *disk) spin_unlock_irq(&ioc->lock); /* - * rqos must be added before activation to allow iocg_pd_init() to + * rqos must be added before activation to allow ioc_pd_init() to * lookup the ioc from q. This means that the rqos methods may get * called before policy activation completion, can't assume that the * target bio has an iocg associated and need to test for NULL iocg. From patchwork Mon Oct 17 02:00:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1228091wrs; Sun, 16 Oct 2022 19:02:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ME43G8gD/wEEUBQE7h5sZI1PV/AadT6laSzEvQ59n8g5lV40fEqIZ3e0ZTiEJzHDHi0K1 X-Received: by 2002:a17:90a:db54:b0:209:e4e4:9344 with SMTP id u20-20020a17090adb5400b00209e4e49344mr30079776pjx.62.1665972138124; Sun, 16 Oct 2022 19:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972138; cv=none; d=google.com; s=arc-20160816; b=bV/emf2MmRrvwzDQJDAYpAtOiQglTnV+6hRe32xG3GTOCDYDQxFGDhu4yKf35WBiBl oa/fAEn8A2VJ7otC77PwzP+eAOFu51ivkuEl2saQ+PwEj4C/hFV3s6d+Q+Eyg+uBsFIg hGysegAb2ryvCcknMFwUQxKNC/PLk+mAA+VvHvvuv8/bv9lvsUtHtFoTGqQJk6p5+XUt FMvWY6nZnD+rIQwpEl7HKobO7R46T3Zyr2SgQ3U6MVAm6sDCd+PkMrsyExmz79fg3G+R NYJHMQfk/UocDjXJIt+J32qeVUOk2LtoDAc4vnMIr+o7YhPgzSBCycFefclm65afJmwD Zafw== 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=BuUH4PUGrcVcgAlB4+pi3JSy0vp+k73fNMXCgLyOUPQ=; b=bW62u62oFubK01RgeIm3xypkFDD8zLE2Z4O4TcXYiqicS9ob1Z+CuN+VkpYqtxugrX ygDM+YYuapzdI2K44G8adOq0NDuJTH3Q4zRo9rtY5V3nBujMC9liQKe/gg5O9KNKJVuI JEk0MhaLQ9uXYZlPn3R3hVwKDHQ6LbBJlA0aqBXP0UIDRSFZLWXwYbNx/6BS9+bMS6Wk wQbK78rLsZvYu4uU7NJGTu/CBI+ZMTAacIq4+F2Ct4aqHWxtmxmXfT47u6B8ksq/aklz 4ePco5Q0RKeh5VOtEWzkE/Rs9VO80tu01tGvNTsLbYQjhZ6Fzm/YLbQoFvj+ruq9FT6a sCYA== 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 b4-20020a630c04000000b0045f98453934si11020809pgl.872.2022.10.16.19.02.05; Sun, 16 Oct 2022 19:02:18 -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 S230103AbiJQCAl (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiJQCAU (ORCPT ); Sun, 16 Oct 2022 22:00:20 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36B5237C0; Sun, 16 Oct 2022 19:00:19 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MrKrP1ZrhzJnV4; Mon, 17 Oct 2022 09:57:41 +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:17 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 6/8] blk-iocost: Avoid to call current_hweight_max if iocg->inuse == iocg->active Date: Mon, 17 Oct 2022 10:00:09 +0800 Message-ID: <20221017020011.25016-7-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?1746898401038679772?= X-GMAIL-MSGID: =?utf-8?q?1746898401038679772?= The old_hwi is already max hweight_inuse if iocg->inuse == iocg->active. Remove unnecessary calculation. Signed-off-by: Kemeng Shi --- block/blk-iocost.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 96c1571a8a1d..fa90f471dfdc 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2299,7 +2299,10 @@ static void ioc_timer_fn(struct timer_list *timer) * Determine the donation amount. */ current_hweight(iocg, &hwa, &old_hwi); - hwm = current_hweight_max(iocg); + if (iocg->inuse == iocg->active) + hwm = old_hwi; + else + hwm = current_hweight_max(iocg); new_hwi = hweight_after_donation(iocg, old_hwi, hwm, usage, &now); /* From patchwork Mon Oct 17 02:00:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1228368wrs; Sun, 16 Oct 2022 19:02:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XQfW+oQ7JuJ6yGCBwm6J9y5SskraYBAovhUHTogNFAmxcsRKKFiXz4FF1YIh+HKChwUqp X-Received: by 2002:a63:c104:0:b0:459:c6a1:15c0 with SMTP id w4-20020a63c104000000b00459c6a115c0mr8358299pgf.588.1665972177405; Sun, 16 Oct 2022 19:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972177; cv=none; d=google.com; s=arc-20160816; b=tAjGofKEaRywmhsPOwIJ6X8B1j52giOfA552ULhHurBq3dFqMDT0ypoJch4kPyzjty 0WalmLmKANNW5Onn4g2V6M2fY0r+JqhibHVQxKzYKNm19Awas3XmawaLyvQ1/qoIdM4R 5xGmSesr2IhDHxGYj+Dby9vP/NsxbTapRTD4mxyOZhhMm5x3jPFyosZsNsJpuT0fBTy5 6nlWpUUnX6fvS0XBcuYheUCtT6EDQBbZiJh7K7YVxnXJYNBOG90/ELm/KsGCbKzgFWWR tpmMeGYV42xML71duiqO0cucuyk1J5ggDQwz+U4TI55BB80ESIdoNDJooyRzBfvHSGuz kFNA== 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=TMrMKqcdeNwHz0wjIwawlYh9NxDAQtmMbbNP7dV+Rv4=; b=ADrkEZ4YmGl8ALli2904CPiJ7J5jEja9ucby85LnRIDN2QAVMuT4bqxiwW0CnKq4vc fEL5CTj6Wfz0iawe0l/eKvjKsVvuvQAwPWlKhMQFVmlkcsp5Ff5UExesCoZ03HXx1dLA Kvk4hB1bp9Qy/ZDYu9nZ6cAKj+ZkY2sFN/6aAGZ8qVBvMfXuF0TaB6McJ3TTil70+h5s TNClaEHY0vy8ng93apnQWT9A9eeSrhyEKZp5Xca+fHVhNtgpXqBPazQUYdf7H5SYC0Au 680FBHP6m4jMzQDef9Pqmbis2GPnvHxqQb2d4IoRcRZuTiCofVg32IO6o+l5XTLddVR5 IV3Q== 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 u15-20020a170902e5cf00b00172f237cd04si12385729plf.108.2022.10.16.19.02.44; Sun, 16 Oct 2022 19:02:57 -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 S230105AbiJQCAp (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbiJQCAV (ORCPT ); Sun, 16 Oct 2022 22:00:21 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49BEF248E0; Sun, 16 Oct 2022 19:00:20 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MrKp14d6czmVCT; Mon, 17 Oct 2022 09:55:37 +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:17 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 7/8] blk-iocost: Remove redundant initialization of struct ioc_gq Date: Mon, 17 Oct 2022 10:00:10 +0800 Message-ID: <20221017020011.25016-8-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?1746898441595234103?= X-GMAIL-MSGID: =?utf-8?q?1746898441595234103?= Some member of struct ioc_gq will not be accessed before it's first activation and will be initialized again in it's first activation after ioc_pd_init. To be more specific: 1)Member iocg->vtime and iocg->done_vtime will set to target in activation which only expects vtime is equal to done_vtime in first activation. 2)Member iocg->active_period will be set with ioc->cur_period again in first activation. Remove the redundant initialization to improve ioc_pd_init a littile bit. The parameter now of weight_updated will not be used if iocg is not active, so pass NULL to weight_update here is safe and we can remove call to ioc_now. Signed-off-by: Kemeng Shi --- block/blk-iocost.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index fa90f471dfdc..4815e676733d 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2946,16 +2946,10 @@ static void ioc_pd_init(struct blkg_policy_data *pd) struct ioc_gq *iocg = pd_to_iocg(pd); struct blkcg_gq *blkg = pd_to_blkg(&iocg->pd); struct ioc *ioc = q_to_ioc(blkg->q); - struct ioc_now now; struct blkcg_gq *tblkg; unsigned long flags; - ioc_now(ioc, &now); - iocg->ioc = ioc; - atomic64_set(&iocg->vtime, now.vnow); - atomic64_set(&iocg->done_vtime, now.vnow); - atomic64_set(&iocg->active_period, atomic64_read(&ioc->cur_period)); INIT_LIST_HEAD(&iocg->active_list); INIT_LIST_HEAD(&iocg->walk_list); INIT_LIST_HEAD(&iocg->surplus_list); @@ -2974,7 +2968,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd) } spin_lock_irqsave(&ioc->lock, flags); - weight_updated(iocg, &now); + weight_updated(iocg, NULL); spin_unlock_irqrestore(&ioc->lock, flags); } From patchwork Mon Oct 17 02:00:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 3182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1228446wrs; Sun, 16 Oct 2022 19:03:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70uKm1x8A7dwFfI81PF57JHdhK2jqlwYDCqouLgV+6hDJkU+3PKdo8pZhRTHysgmZHMZ2M X-Received: by 2002:a05:6a00:1907:b0:564:f6be:11fc with SMTP id y7-20020a056a00190700b00564f6be11fcmr9852192pfi.47.1665972194358; Sun, 16 Oct 2022 19:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972194; cv=none; d=google.com; s=arc-20160816; b=Qn1uTU3loSQDtfbQ1pBDc6FqrcShMIDSZi8lwn3dVcVz5rrWhrVHrIsZzQsG5Re2jo Q05L0rVwL0MiVRYZ/jYlv3orLTYi21Or2KgSlET8h0KSwN+m3YnpouhhS6Z1OyyL+y0f pX6SF9ccTTipdMX0ogjji3CmALSRahMLwKPoirxwXSiUsKEbt8lgBPyzWeiJv0gKeJ+v 9wN9o3Jo7SzaKkI6XZY33bkDYz/K9gJ7ezn+2jZ0HwM2Qhqt5y+N0TFVsVAfRPfXE4tC DsXfSZ8oNn4bgvER0n3GI2A2HD/C7gGqTmqlljKBNznMuqP2ReE+jRjwImuVcEtJdrls xfLQ== 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=x8hC91BZ5NTGEPosqY03RU642OsBOcX2WbA5dKY/Ik4=; b=M31GbkzqoL2alYxD7JpNvgDhEYejFcbN86cvqrsqIX/Mfz3pT7xkMouvlxA8CtdniA 2mNIO4xA8QsvVPOmA1BmQSy33uFHC546ad76veyfNR3k74W/MrmpR9KEyKK2bQ+3/WLb E/qggU2sywRBd/KIfT/ae2b43SwbmAawxeRmWrGU8+lXhrMzJBL4ZLot6ljxDkEGxBIE Or0+v864M7zn84yCbedi37X2YFPA7sCQ3ZEmPiAMpqqEaz8gMSiHg3NLEYc38hlS9RNo U+ucjrE3+Kz8cKZ7+XdV29TH/KEYye7kR3K+rsia1h9ASkP8pY9N56pR3z85o8O9rA4l 85pg== 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 k7-20020a635a47000000b00457f36aba6esi9000568pgm.531.2022.10.16.19.03.02; Sun, 16 Oct 2022 19:03: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 S230135AbiJQCAr (ORCPT + 99 others); Sun, 16 Oct 2022 22:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbiJQCAV (ORCPT ); Sun, 16 Oct 2022 22:00:21 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1817F26101; Sun, 16 Oct 2022 19:00:21 -0700 (PDT) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MrKqg1lPtzpW9D; Mon, 17 Oct 2022 09:57:03 +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:18 +0800 From: Kemeng Shi To: , , , CC: Subject: [PATCH 8/8] blk-iocost: Get ioc_now inside weight_updated Date: Mon, 17 Oct 2022 10:00:11 +0800 Message-ID: <20221017020011.25016-9-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?1746898459706889687?= X-GMAIL-MSGID: =?utf-8?q?1746898459706889687?= The ioc_now parameter of weight_updated is only needed if we need call propagate_weights. Move ioc_now inside weight_updated to remove unnecessary get of ioc_now from outside of weight_updated. Signed-off-by: Kemeng Shi --- block/blk-iocost.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 4815e676733d..e2aaf133deb8 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1220,18 +1220,21 @@ static u32 current_hweight_max(struct ioc_gq *iocg) return max_t(u32, hwm, 1); } -static void weight_updated(struct ioc_gq *iocg, struct ioc_now *now) +static void weight_updated(struct ioc_gq *iocg) { struct ioc *ioc = iocg->ioc; struct blkcg_gq *blkg = iocg_to_blkg(iocg); struct ioc_cgrp *iocc = blkcg_to_iocc(blkg->blkcg); + struct ioc_now now; u32 weight; lockdep_assert_held(&ioc->lock); weight = iocg->cfg_weight ?: iocc->dfl_weight; - if (weight != iocg->weight && iocg->active) - propagate_weights(iocg, weight, iocg->inuse, true, now); + if (weight != iocg->weight && iocg->active) { + ioc_now(iocg->ioc, &now); + propagate_weights(iocg, weight, iocg->inuse, true, &now); + } iocg->weight = weight; } @@ -2968,7 +2971,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd) } spin_lock_irqsave(&ioc->lock, flags); - weight_updated(iocg, NULL); + weight_updated(iocg); spin_unlock_irqrestore(&ioc->lock, flags); } @@ -3053,7 +3056,6 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, struct blkcg *blkcg = css_to_blkcg(of_css(of)); struct ioc_cgrp *iocc = blkcg_to_iocc(blkcg); struct blkg_conf_ctx ctx; - struct ioc_now now; struct ioc_gq *iocg; u32 v; int ret; @@ -3074,8 +3076,7 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, if (iocg) { spin_lock(&iocg->ioc->lock); - ioc_now(iocg->ioc, &now); - weight_updated(iocg, &now); + weight_updated(iocg); spin_unlock(&iocg->ioc->lock); } } @@ -3101,8 +3102,7 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf, spin_lock(&iocg->ioc->lock); iocg->cfg_weight = v * WEIGHT_ONE; - ioc_now(iocg->ioc, &now); - weight_updated(iocg, &now); + weight_updated(iocg); spin_unlock(&iocg->ioc->lock); blkg_conf_finish(&ctx);