From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05AAA13B584 for ; Mon, 20 Apr 2026 04:03:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776657815; cv=none; b=AJEgMd7AUMgVdlim4xjaYDIBIp+YxuGox9YSt/oZt0xCu0gQmhjUG8bIxE/hAsFZJ8saZM8MJDWvPMmwyEa4Mt5praZq5QLyTAxvxwFTHKk/6aTZ4uzXE6Lp5Hh8wQAcNDEzRJ5iBZtcBNjprjvOSAiAIKxjERbieJLEnRIaVME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776657815; c=relaxed/simple; bh=ApaWyoT9kt4KnHVFuQmBJO2ovknUkqJbUJcM99ANueU=; h=Message-ID:Date:MIME-Version:Subject:From:To:CC:References: In-Reply-To:Content-Type; b=MCDOHJpSpySsew4/QuUq5DU9KSLTQUj19bRCcULqfKU1bfZFGdUnqCKduVMBJko8nh8vGuCElYrzWNzZk8dULjzFTtUpQQdpx31ss9SAfVLxfLnufK/dVEOaSvM385NtKWSD6va9xijCdsWOIzy6sVFf8JvWuPbP6y3wMR+rAFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=vf1VuRgG; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="vf1VuRgG" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=YPF8ZHW0STClxnS3/oMQp13y6YBcrjSR8DygISRrBYY=; b=vf1VuRgGZPzPfbOEZOghajOGNOyDhXgfm9Hn76fqtS133qYrGN/ulTQ8jN95/LXYD5LIa2Gp8 Jqg1XAinkkuOSuzFEbzzUNXpXU9ruBz60TijNQZVXjBk1cQYGkQZ+ZBgr2wFa5LBeyLiEhYY8jp DASLiD4tTvq45mT188LjgN4= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4fzWrw19bczLlSv; Mon, 20 Apr 2026 11:57:04 +0800 (CST) Received: from kwepemr500016.china.huawei.com (unknown [7.202.195.68]) by mail.maildlp.com (Postfix) with ESMTPS id A6B7140571; Mon, 20 Apr 2026 12:03:24 +0800 (CST) Received: from [10.67.111.161] (10.67.111.161) by kwepemr500016.china.huawei.com (7.202.195.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 20 Apr 2026 12:03:24 +0800 Message-ID: <08dafa41-8446-43e9-9a28-0b4addc5e188@huawei.com> Date: Mon, 20 Apr 2026 12:03:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails. From: chenjinghuang To: "mingo@redhat.com" , "peterz@infradead.org" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "linux-kernel@vger.kernel.org" CC: "dietmar.eggemann@arm.com" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" , "vschneid@redhat.com" References: <20260320013419.2493925-1-chenjinghuang2@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: kwepems200002.china.huawei.com (7.221.188.68) To kwepemr500016.china.huawei.com (7.202.195.68) On 3/27/2026 11:53 AM, chenjinghuang wrote: > On 3/20/2026 9:34 AM, Chen Jinghuang wrote: >> For example: >> >> # cat /proc/sys/kernel/sched_rt_runtime_us >> 950000 >> # echo 940000 > /proc/sys/kernel/sched_rt_runtime_us >> -bash: echo: write error: Invalid argument >> >> This occurs because when the global RT quota is reduced while the root >> cgroup’s ratio remains unchanged, the root cgroup’s proportion ends up >> exceeding the global RT ratio. This is unreasonable: the root cgroup’s >> ratio should be updated when the global RT ratio changes. >> >> This patch ensures the root cgroup’s RT quota is adjusted whenever the >> global RT quota is modified. >> >> Signed-off-by: Chen Jinghuang >> Tested-by: Madadi Vineeth Reddy >> Reviewed-by: Chen Ridong >> --- >> kernel/sched/rt.c | 12 +++++++++++- >> 1 file changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c >> index f1867fe8e5c5..30770ba7be4e 100644 >> --- a/kernel/sched/rt.c >> +++ b/kernel/sched/rt.c >> @@ -2814,9 +2814,11 @@ long sched_group_rt_period(struct task_group *tg) >> static int sched_rt_global_constraints(void) >> { >> int ret = 0; >> + u64 period = global_rt_period(); >> + u64 runtime = global_rt_runtime(); >> >> mutex_lock(&rt_constraints_mutex); >> - ret = __rt_schedulable(NULL, 0, 0); >> + ret = __rt_schedulable(&root_task_group, period, runtime); >> mutex_unlock(&rt_constraints_mutex); >> >> return ret; >> @@ -2856,6 +2858,14 @@ static int sched_rt_global_validate(void) >> >> static void sched_rt_do_global(void) >> { >> +#ifdef CONFIG_RT_GROUP_SCHED >> + if (!rt_group_sched_enabled()) >> + return; >> + >> + WARN_ON_ONCE(tg_set_rt_bandwidth(&root_task_group, >> + global_rt_period(), >> + global_rt_runtime())); >> +#endif >> } >> >> static int sched_rt_handler(const struct ctl_table *table, int write, void *buffer, > ping Hi, Gentle ping on this patch. I'd appreciate any feedback whenever you get time, or let me know if I should resend/rework anything. Regards, Chen Jinghuang