Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7120183rwb; Wed, 23 Nov 2022 02:23:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf4B8ik4qB/2q4gp42bWxuZqO5EfTxFIp1rUnkkwYldC+J8LzoXEPybgZWXXQCfSq5itjSts X-Received: by 2002:a05:6402:d5d:b0:469:2071:1b5c with SMTP id ec29-20020a0564020d5d00b0046920711b5cmr20010480edb.279.1669199022711; Wed, 23 Nov 2022 02:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669199022; cv=none; d=google.com; s=arc-20160816; b=M83iizkj44YSFeZ4CJOXt+xfmnuelrRDbnnUK19uVo1FuUl3fONsm1FBBn6j/LJ6nC f8YLGQ+xomZthDLLTv0zjUAmODdVTdoxK2z2a+hJ2Xi08Mfw3PLNK1g0IlqqJ2TQqIzc QX8rMtgVWB65go3XtRAesT4vZHSCTyQsfqceI9Z17K3RaccJSqt1TJmp1gJ+LpyY9H5P 9nMMntbMSkK7V4jnoZZwPHMH7jL7USODhXonw63nBUidtkjAnBY/YJJsQVwCCUtZCZyB 6afilFDmyhoAKUjMhIz+gbP2wpqY7U6Iu0tnIH9fY0ik5ARm9+n9Dme0Xv60xwl9PGvA FNuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:subject:user-agent:mime-version:date:message-id; bh=wDCzlNXB8Djakwzk3PQJRhbNeCuAZxHss298spLtG14=; b=KWfrSe6ZuKp97AlJEGZijlQA0E+pvAYXS8xHBZaJ0rB+VQBy8g9uKs8tK4oSgIgSoR VgEE5C9nwcgJCCDbPoSnsRJdyCJh4vVTpg0zknN1H09FFpJ72Mvp7wh+VHcCYQaEkplI F1EePPj0s/VML4E6QPD4Uksx/31gVpo3O0sjaMo76mWq0Jb37LudVcy7AMfO3ku2UgXg KmEKIJOJdxZBPrBaBJBDbxfztoCtRFrNRN0A7SznAakop595fTL1t4s7hlCoXy3xmx8k F14T0r9fZndxKN0PY2eG8vDAVkQVKAdGgL0MOv9vca7GI/fDgHQp5g+r9Ci3A3ifJYZy fnKA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js15-20020a17090797cf00b007aea0bbe2e2si15898774ejc.394.2022.11.23.02.23.20; Wed, 23 Nov 2022 02:23:42 -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 S235505AbiKWIwn (ORCPT + 88 others); Wed, 23 Nov 2022 03:52:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbiKWIwl (ORCPT ); Wed, 23 Nov 2022 03:52:41 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C4B819C07 for ; Wed, 23 Nov 2022 00:52:37 -0800 (PST) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NHFHT0fwPz15Mml; Wed, 23 Nov 2022 16:52:05 +0800 (CST) Received: from [10.67.110.25] (10.67.110.25) by dggpemm500022.china.huawei.com (7.185.36.162) 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 16:52:35 +0800 Message-ID: <47efc7e4-75bd-8302-48e8-1ddb2be48886@huawei.com> Date: Wed, 23 Nov 2022 16:52:29 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] sched/fair: limit burst to zero when cfs bandwidth is toggled off From: "zhaowenhui (A)" To: CC: , , , , , , , , , , , , , , References: <20220809120320.19496-1-zhaowenhui8@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.25] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500022.china.huawei.com (7.185.36.162) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 在 2022/9/30 16:32, zhaowenhui (A) 写道: > > > 在 2022/8/30 11:19, zhaowenhui (A) 写道: >> >> >> 在 2022/8/9 20:03, Zhao Wenhui 写道: >>> When the quota value in CFS bandwidth is set to -1, that imples the >>> cfs bandwidth is toggled off. So the burst feature is supposed to >>> be disable as well. >>> >>> Currently, when quota is -1, burst will not be check, so that it can be >>> set to almost arbitery value. Examples: >>>          mkdir /sys/fs/cgroup/cpu/test >>>          echo -1 > /sys/fs/cgroup/cpu/test/cpu.cfs_quota_us >>>          echo 10000000000000000 > >>> /sys/fs/cgroup/cpu/test/cpu.cfs_burst_us >>> >>> Moreover, after the burst modified by this way, quota can't be set >>> to any value: >>>          echo 100000 > cpu.cfs_quota_us >>>          -bash: echo: write error: Invalid argument >>> >>> This patch can ensure the burst value being zero and unalterable, >>> when quota is set to -1. >>> >>> Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS >>> controller") >>> Reported-by: Zhao Gongyi >>> Signed-off-by: Zhao Wenhui >>> --- >>>   kernel/sched/core.c | 10 +++++++++- >>>   1 file changed, 9 insertions(+), 1 deletion(-) >>> >>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >>> index ee28253c9ac0..4c1fc01d8c68 100644 >>> --- a/kernel/sched/core.c >>> +++ b/kernel/sched/core.c >>> @@ -10584,6 +10584,12 @@ static int tg_set_cfs_bandwidth(struct >>> task_group *tg, u64 period, u64 quota, >>>                        burst + quota > max_cfs_runtime)) >>>           return -EINVAL; >>> +    /* >>> +     * Ensure burst equals to zero when quota is -1. >>> +     */ >>> +    if (quota == RUNTIME_INF && burst) >>> +        return -EINVAL; >>> + >>>       /* >>>        * Prevent race between setting of cfs_rq->runtime_enabled and >>>        * unthrottle_offline_cfs_rqs(). >>> @@ -10643,8 +10649,10 @@ static int tg_set_cfs_quota(struct >>> task_group *tg, long cfs_quota_us) >>>       period = ktime_to_ns(tg->cfs_bandwidth.period); >>>       burst = tg->cfs_bandwidth.burst; >>> -    if (cfs_quota_us < 0) >>> +    if (cfs_quota_us < 0) { >>>           quota = RUNTIME_INF; >>> +        burst = 0; >>> +    } >>>       else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC) >>>           quota = (u64)cfs_quota_us * NSEC_PER_USEC; >>>       else >> >> Gentle ping. >> >> Thanks, >> Zhao Wenhui > > Dear Maintainers, > Hi, this patch has been reviewed by two reviewers over a month ago. > So, Any more suggestions for this patch or it can be picked? > > Regards, > Zhao Wenhui Peter, Sorry to disturbed, for this patch is submitted long long time ago... And this is my first patch, so I really wonder if there is something to be improved for the patch. Looking forward to your reply. Thank you, Zhao Wenhui