From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout08.his.huawei.com (canpmsgout08.his.huawei.com [113.46.200.223]) (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 CF2E537267B for ; Fri, 27 Mar 2026 03:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.223 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774583644; cv=none; b=Xcb+Ub+vx2Ymm72gYxM97kz4UeXQGD7YDfD0u4c6zYXlZyTWOtWAHkj8Cbja9zeN6spmEaByRlwHrQ3O+etZ2hikh2WDhqgxx0eNSi1O32Hk98yZcIChtsql0+rsyoeW8zxcaP+mZe4m31QhH8Iae0g/l9hT4XuMbW//mwoMdTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774583644; c=relaxed/simple; bh=jkdHGW1Q/55N5OMwjdbMxN5sst7QNHchsQWi4yPPdrI=; h=Message-ID:Date:MIME-Version:Subject:From:To:CC:References: In-Reply-To:Content-Type; b=ZThzdh2ymN8i0RWLw/+QRIIkAzg1I6svExdhFRo5wMkCvh7NMRtHP4sh0chn4aVr+nlSFMsYrPra0yfex9BP4aYdKiUWN0yzEgavjjvZpd6xH5Dof1M1Tf0koVOSldcWVdL+pmoMmeWAc/YGUsFZeBRcNdTrwKTofZzebGk+0ow= 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=N2trk3UV; arc=none smtp.client-ip=113.46.200.223 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="N2trk3UV" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=DFryGlrRzZwocQZaU0KtCWGy/CJc/qqfqfNqvJl0nZ4=; b=N2trk3UVpIKBAQWajLljUf90AqAi/i5623NBf+jQ1JI7upynOBaNcsWSwCMhJHTaZS0YvvIPB slKbUksMssLwQKqou+qREC6qa/92sgdgQk5gG+P2O9P45pJvgdSWqEMGg3F4/29UIUxsJ0r4xUp SUYePBvOxQBchkMm31X3G/I= Received: from mail.maildlp.com (unknown [172.19.163.163]) by canpmsgout08.his.huawei.com (SkyGuard) with ESMTPS id 4fhmnK4FPpzmVYF; Fri, 27 Mar 2026 11:47:49 +0800 (CST) Received: from kwepemr500016.china.huawei.com (unknown [7.202.195.68]) by mail.maildlp.com (Postfix) with ESMTPS id A8DD64048B; Fri, 27 Mar 2026 11:53:57 +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; Fri, 27 Mar 2026 11:53:57 +0800 Message-ID: Date: Fri, 27 Mar 2026 11:53:56 +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: <20260320013419.2493925-1-chenjinghuang2@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemr500016.china.huawei.com (7.202.195.68) 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 Ridong > Tested-by: Madadi Vineeth Reddy > Reviewed-by: Chen Jinghuang > --- > 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