The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@atomlin.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	shashank.mahadasyam@sony.com, longman@redhat.com,
	mkoutny@suse.com, tj@kernel.org, atomlin@atomlin.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sched/core: Report failed rt migrations to non-root cgroup without rt bandwidth under RT_GROUP_SCHED
Date: Mon, 15 Sep 2025 21:11:46 -0400	[thread overview]
Message-ID: <20250916011146.4129696-1-atomlin@atomlin.com> (raw)

Following on from commit c7461cca91 ("cgroup, docs: Be explicit about
independence of RT_GROUP_SCHED and non-cpu controllers"), this patch
introduces an explicit error message that informs the user why the
task migration failed. Now user-mode has a clear and actionable reason
for the failure, greatly assisting with debugging.

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
 kernel/sched/core.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 62b3416f5e43..b9d7689d21e4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -9185,8 +9185,18 @@ static int cpu_cgroup_can_attach(struct cgroup_taskset *tset)
 		goto scx_check;
 
 	cgroup_taskset_for_each(task, css, tset) {
-		if (!sched_rt_can_attach(css_tg(css), task))
+		struct task_group *tg = css_tg(css);
+
+		if (!sched_rt_can_attach(tg, task)) {
+			if (tg != &root_task_group) {
+				pr_err_ratelimited("cgroup: cannot attach "
+						"cpu controller. Task "
+						"%s:%d is not in the root "
+						"cgroup.", task->comm,
+						task_pid_nr(task));
+			}
 			return -EINVAL;
+		}
 	}
 scx_check:
 #endif /* CONFIG_RT_GROUP_SCHED */
-- 
2.49.0


             reply	other threads:[~2025-09-16  1:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16  1:11 Aaron Tomlin [this message]
2025-09-16  9:09 ` [PATCH] sched/core: Report failed rt migrations to non-root cgroup without rt bandwidth under RT_GROUP_SCHED Michal Koutný
2025-09-16 14:47   ` Aaron Tomlin
2025-09-16 15:44     ` Michal Koutný
2025-09-16 16:57       ` Aaron Tomlin
2025-09-16 17:07         ` Phil Auld
2025-09-16 17:23           ` Aaron Tomlin
2025-09-16 17:32             ` Phil Auld
2025-09-17  9:37         ` Michal Koutný
2025-09-19 22:24           ` Aaron Tomlin

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=20250916011146.4129696-1-atomlin@atomlin.com \
    --to=atomlin@atomlin.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shashank.mahadasyam@sony.com \
    --cc=tj@kernel.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