From patchwork Wed Nov 23 06:03:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 24717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2614617wrr; Tue, 22 Nov 2022 22:05:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iaaBA4oyUWyga3SuZb3uWAJDfYJzsmyI3ZOEBXV/rtyM7JbV4t5HmjRDJBAaVkvXSVGQf X-Received: by 2002:a17:903:1c4:b0:186:5ef5:bda1 with SMTP id e4-20020a17090301c400b001865ef5bda1mr7258251plh.78.1669183516809; Tue, 22 Nov 2022 22:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669183516; cv=none; d=google.com; s=arc-20160816; b=ecH5jMrAivUnkvdKG6oCavyz+SAKw6vTepQH3TSAIsxRUpuHREQ71Lop6wvFSZh5oQ OA3Nvkgw9jJ3GXUjXXi3qqgUaYRE3ll5uRtWOAZeoKJPEUNtyty3Rxf2WrUkozU8otJ6 cWUzDLEXxXtItw+rKEbxyEWeCZPaG/0jtOmkZ3Nezzc0VyucAEoHi/Qpu0cLPYj1G0Xe oSTsVfR8lZUneQycCHl5oKaMaqHzYcHMM96hZcIZjzpOYhga2UFsi+fTrTqOyJ7K++Qe ua0faJ8WfhZExBlY6ppMohze6zKY5FYeO3bQj0/K065CvR6aX4Od6Lka/hzDASY1FXeH 9ALw== 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=EQHANdk/M9WEOYUTzwJxac4ccziLf7UXV4NLqo80jZY=; b=BUDEBmuLNXBhFOj6Dl9wajPk2Im79BpDn37yKL7UNdzW0A5Gpl9U40mi++d/qVwuoE T4QPC9YDKZhsdD61Q74yiyWcttzLrgvaPet/DUpf9TbbsKiHWVsNlhRiJyWbI2mpRoft 00EuQ8tK5EWJCyYYogWqK1UM8ZxkpxvOrp+Bhdd2V28GphfW/f1bdjWfIEV6w/W1pRUf 2rb8uq/tPVPvukRufJbSpUzNXBxMT84YJF6SLKzBBey/jyjp0I+mv2dh1fP9eqlp24jZ GInVnYG+8FhNvv1p1l1XKgSdfLNEdA/fqQ8x4W666RBECvReDBflTMTB0BgN1XexC+kM J8GQ== 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 kb11-20020a17090ae7cb00b0020a755f2b83si1066722pjb.100.2022.11.22.22.05.04; Tue, 22 Nov 2022 22:05:16 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235606AbiKWGEf (ORCPT + 99 others); Wed, 23 Nov 2022 01:04:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235611AbiKWGEK (ORCPT ); Wed, 23 Nov 2022 01:04:10 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29833DB86F; Tue, 22 Nov 2022 22:04:07 -0800 (PST) Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NH9Y15C6xzmW6g; Wed, 23 Nov 2022 14:03:33 +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; Wed, 23 Nov 2022 14:04:04 +0800 From: Kemeng Shi To: , , CC: , , , Subject: [PATCH 01/11] blk-throttle: Limit whole system if root group is configured when on the default hierarchy Date: Wed, 23 Nov 2022 14:03:51 +0800 Message-ID: <20221123060401.20392-2-shikemeng@huawei.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20221123060401.20392-1-shikemeng@huawei.com> References: <20221123060401.20392-1-shikemeng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.129] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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?1750265775209069801?= X-GMAIL-MSGID: =?utf-8?q?1750265775209069801?= Quoted from comment in throtl_pd_init: "If on the default hierarchy, we switch to properly hierarchical behavior where limits on a given throtl_grp are applied to the whole subtree rather than just the group itself. e.g. If 16M read_bps limit is set on the root group, the whole system can' exceed 16M for the device." Commit b22c417c885ea9 ("blk-throttle: configure bps/iops limit for cgroup in low limit") broke this rule and did not explain why. Restore the ability to limit the whole system by root group. Signed-off-by: Kemeng Shi --- block/blk-throttle.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 847721dc2b2b..96aa53e30e28 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -150,9 +150,6 @@ static uint64_t tg_bps_limit(struct throtl_grp *tg, int rw) struct throtl_data *td; uint64_t ret; - if (cgroup_subsys_on_dfl(io_cgrp_subsys) && !blkg->parent) - return U64_MAX; - td = tg->td; ret = tg->bps[rw][td->limit_index]; if (ret == 0 && td->limit_index == LIMIT_LOW) { @@ -180,9 +177,6 @@ static unsigned int tg_iops_limit(struct throtl_grp *tg, int rw) struct throtl_data *td; unsigned int ret; - if (cgroup_subsys_on_dfl(io_cgrp_subsys) && !blkg->parent) - return UINT_MAX; - td = tg->td; ret = tg->iops[rw][td->limit_index]; if (ret == 0 && tg->td->limit_index == LIMIT_LOW) {