Message ID | 20221205115709.251489-3-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2054974wrr; Sun, 4 Dec 2022 19:58:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf5GeGCB5xeq2/ZTRiQCB/9TXEQpeQXwa2PEMlg/R8eP5ywbIidLndsQl1yjHDGYU22pPsje X-Received: by 2002:a17:90a:d18b:b0:219:6be1:7ff2 with SMTP id fu11-20020a17090ad18b00b002196be17ff2mr23849352pjb.79.1670212724691; Sun, 04 Dec 2022 19:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670212724; cv=none; d=google.com; s=arc-20160816; b=SaPNBaSxklLOCSUSYCt5jzWDb8elPvJ6lE6ZJMFcN0rFPH8rAB2mQY+Faxb7GWBodp 06LzVhXYiYV+3rIOjQA6AoKj6UZbFrj37jTIuXZ6K5uMAfbCTQWjaVb7EHgCLZRhTVW/ GlOTfyD+YCYFIVyZMf1kQhWCsJQNccRik8rePrSKIqTp1v/GfJ51feo0VpNfsGsOTuAU H1xzmq5vXRKWCZfu6Y/44QBGh0Dw/eHTEAhAEwMtCwJID6LQyoVXI/r2O9guFjm1sFAq iX4sGcTWOVL8toZvvpkanDNBKUQ4JErSXEvesa2oR4s4zMDiRG78B6QTl9CHvTVbe37B AGCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=K8cFtJdKdbCdReiaL2VgVsppW4hxq7DI5nS7cOsGcUM=; b=b7dsKBoI+p5a392AT2wgRpvJW37k2voRcfbl8ArB6KEURnqWWvyMzoddpjn7EwVDOn zVuPKJy4t71BanTwOAK1DkX7IHjzOSWMXy5fcDLfV9qYg7QUFEAkR3hm7Jff8YVIqWMf hbTFCqw+9ZKf1qBwqjaQP6M7g3EiVt9poovZGc7m03yMNi+1BJ0x46uiQp2IGzD9aggT M96qrN/GR3jHl9SLlJJ+QqByJlYficY8HKlMA/vaHlI3SKQcG+x7uRcE9amS/FeRqh/0 jzOg3rTsCLbNWG2Cedb62fie88sMvt4PBTdEAxIMiOCZXtqVdZoo+1gRD2hMPmJo/B9K gbyw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a170903110700b00186abd0c784si15566129plh.217.2022.12.04.19.58.31; Sun, 04 Dec 2022 19:58:44 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231458AbiLED6I (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Sun, 4 Dec 2022 22:58:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbiLED6B (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 4 Dec 2022 22:58:01 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A72F4FCEC; Sun, 4 Dec 2022 19:57:58 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NQVBS64FQz4f3pG5; Mon, 5 Dec 2022 11:57:52 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgDXfq1CbI1jRaRVBg--.57323S4; Mon, 05 Dec 2022 11:57:55 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, shikemeng@huawei.com, linfeilong@huawei.com, liuzhiqiang26@huawei.com Subject: [PATCH v3 2/9] blk-throttle: Fix that bps of child could exceed bps limited in parent Date: Mon, 5 Dec 2022 19:57:02 +0800 Message-Id: <20221205115709.251489-3-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20221205115709.251489-1-shikemeng@huaweicloud.com> References: <20221205115709.251489-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgDXfq1CbI1jRaRVBg--.57323S4 X-Coremail-Antispam: 1UD129KBjvJXoW7AF47uF18ur17Grykuw1kAFb_yoW8Aw1fpr WrCF4kCr4qgr4qkr1FqanxXay8tw4rCrWayFZ5GF4fAr9rWwn3GF1q9F18Z3ZxZF93C390 vrsIg347Ja4UJ3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB0b4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUXwA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l 84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUVDUUDUUUU X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751344977903734694?= X-GMAIL-MSGID: =?utf-8?q?1751344977903734694?= |
Series |
A few bugfix and cleanup patches for blk-throttle
|
|
Commit Message
Kemeng Shi
Dec. 5, 2022, 11:57 a.m. UTC
From: Kemeng Shi <shikemeng@huawei.com> Consider situation as following (on the default hierarchy): HDD | root (bps limit: 4k) | child (bps limit :8k) | fio bs=8k Rate of fio is supposed to be 4k, but result is 8k. Reason is as following: Size of single IO from fio is larger than bytes allowed in one throtl_slice in child, so IOs are always queued in child group first. When queued IOs in child are dispatched to parent group, BIO_BPS_THROTTLED is set and these IOs will not be limited by tg_within_bps_limit anymore. Fix this by only set BIO_BPS_THROTTLED when the bio traversed the entire tree. There patch has no influence on situation which is not on the default hierarchy as each group is a single root group without parent. Signed-off-by: Kemeng Shi <shikemeng@huawei.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> --- block/blk-throttle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 8e2349b17936..2444ebf5f11d 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1067,7 +1067,6 @@ static void tg_dispatch_one_bio(struct throtl_grp *tg, bool rw) sq->nr_queued[rw]--; throtl_charge_bio(tg, bio); - bio_set_flag(bio, BIO_BPS_THROTTLED); /* * If our parent is another tg, we just need to transfer @bio to @@ -1080,6 +1079,7 @@ static void tg_dispatch_one_bio(struct throtl_grp *tg, bool rw) throtl_add_bio_tg(bio, &tg->qnode_on_parent[rw], parent_tg); start_parent_slice_with_credit(tg, parent_tg, rw); } else { + bio_set_flag(bio, BIO_BPS_THROTTLED); throtl_qnode_add_bio(bio, &tg->qnode_on_parent[rw], &parent_sq->queued[rw]); BUG_ON(tg->td->nr_queued[rw] <= 0);