The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: chenjinghuang <chenjinghuang2@huawei.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [Question] sched_rt_runtime_us adjustment differs between cgroup v1 and v2 (EINVAL issue)
Date: Mon, 2 Feb 2026 11:39:14 +0000	[thread overview]
Message-ID: <6403a98a2fe44bd18231a5ab2519f477@huawei.com> (raw)

I hope this email finds you well. I'm reaching out to clarify a behavioral difference between cgroup v1 and v2 when adjusting the global sched_rt_runtime_us sysctl parameter, which I've encountered during testing. Below is a detailed description of the issue and my core question:

1. Background & Problem Phenomenon
The default value of /proc/sys/kernel/sched_rt_runtime_us is 950000 us (0.95s). When I attempt to lower this value (e.g., `echo 940000 > /proc/sys/kernel/sched_rt_runtime_us`) in a cgroup v2-only environment, the operation fails with "Invalid argument" (EINVAL).
By tracing the kernel code, I found the failure originates from the tg_rt_schedulable() function, where the following check enforces that the total RT runtime of all task groups (tg->rt_bandwidth.rt_runtime) cannot exceed the global sched_rt_runtime_us:
/* * Nobody can have more than the global setting allows. */ 
if (total > to_ratio(global_rt_period(), global_rt_runtime())) 
return -EINVAL;

2. Key Difference Between cgroup v1 and v2
cgroup v1: I can work around this restriction by first modifying /sys/fs/cgroup/cpu/cpu.rt_runtime_us (the user-space interface for tg->rt_bandwidth.rt_runtime), lowering the root cgroup's RT runtime (e.g., to 940000 us). After this adjustment, setting
sched_rt_runtime_us to 940000us succeeds without EINVAL.
cgroup v2: The cpu.rt_runtime_us interface is no longer available. As a result, there is no way to lower the root cgroup's tg->rt_bandwidth.rt_runtime first, which blocks any attempt to set sched_rt_runtime_us to a value below 950000 us.

3. Core question
Can you explain the design considerations behind this behavioral difference between cgroup v1 and v2 ? Specially:
1. Why was the direct adjustment of tg->rt_bandwidth.rt_runtime (via cpu.rt_runtime_us) removed in cgroup v2 ?
2. Is there an correct way to lower the global sched_rt_runtime_us in cgroup v2?

I appreciate any insights or guidance you can provide. Thank you for your time and help!    

                 reply	other threads:[~2026-02-02 11:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6403a98a2fe44bd18231a5ab2519f477@huawei.com \
    --to=chenjinghuang2@huawei.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox