mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails.
@ 2026-06-25 11:03 Chen Jinghuang
  2026-07-01  8:28 ` chenjinghuang
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Jinghuang @ 2026-06-25 11:03 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak, linux-kernel, Ridong Chen,
	Madadi Vineeth Reddy

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

With CONFIG_RT_GROUP_SCHED enabled, reducing the global RT quota
causes the unchanged root cgroup quota to exceed the new global limit.
The root cgroup quota should be updated accordingly when the global
quota changes.

Adjust the root cgroup's RT quota whenever the global RT quota is
modified.

Signed-off-by: Chen Jinghuang <chenjinghuang2@huawei.com>
Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
Tested-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
Change since v1: https://lore.kernel.org/all/20260320013419.2493925-1-chenjinghuang2@huawei.com/
- Rebase the patch onto mainline.
---
 kernel/sched/rt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index e474c31d8fe6..b1b082e365af 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2858,9 +2858,12 @@ static int sched_rt_global_validate(void)
 #ifdef CONFIG_RT_GROUP_SCHED
 	if (!rt_group_sched_enabled())
 		return 0;
+	
+	u64 period = global_rt_period();
+	u64 runtime = global_rt_runtime();
 
 	scoped_guard(mutex, &rt_constraints_mutex)
-		return __rt_schedulable(NULL, 0, 0);
+		return __rt_schedulable(&root_task_group, period, runtime);
 #endif
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails.
  2026-06-25 11:03 [PATCH v2] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails Chen Jinghuang
@ 2026-07-01  8:28 ` chenjinghuang
  0 siblings, 0 replies; 2+ messages in thread
From: chenjinghuang @ 2026-07-01  8:28 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak, linux-kernel, Ridong Chen,
	Madadi Vineeth Reddy

On 6/25/2026 7:03 PM, 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
> 
Sorry, I forgot that sched_rt_runtime_us is currently set to 1000000,
so it should be the following case:
# cat /proc/sys/kernel/sched_rt_runtime_us
1000000
# echo 940000 > /proc/sys/kernel/sched_rt_runtime_us
-bash: echo: write error: Invalid argument
> With CONFIG_RT_GROUP_SCHED enabled, reducing the global RT quota
> causes the unchanged root cgroup quota to exceed the new global limit.
> The root cgroup quota should be updated accordingly when the global
> quota changes.
> 
> Adjust the root cgroup's RT quota whenever the global RT quota is
> modified.
> 
> Signed-off-by: Chen Jinghuang <chenjinghuang2@huawei.com>
> Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
> Tested-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
> ---
> Change since v1: https://lore.kernel.org/all/20260320013419.2493925-1-chenjinghuang2@huawei.com/
> - Rebase the patch onto mainline.
> ---
>  kernel/sched/rt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index e474c31d8fe6..b1b082e365af 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -2858,9 +2858,12 @@ static int sched_rt_global_validate(void)
>  #ifdef CONFIG_RT_GROUP_SCHED
>  	if (!rt_group_sched_enabled())
>  		return 0;
> +	
> +	u64 period = global_rt_period();
> +	u64 runtime = global_rt_runtime();
>  
>  	scoped_guard(mutex, &rt_constraints_mutex)
> -		return __rt_schedulable(NULL, 0, 0);
> +		return __rt_schedulable(&root_task_group, period, runtime);
>  #endif
>  	return 0;
>  }

Gently ping!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-01  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-25 11:03 [PATCH v2] In cgroup v2, setting a smaller value for sched_rt_runtime_us fails Chen Jinghuang
2026-07-01  8:28 ` chenjinghuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox