public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Filter root_task_group at the beginning
@ 2023-09-22  9:43 Haifeng Xu
  2023-09-28 21:03 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Haifeng Xu @ 2023-09-22  9:43 UTC (permalink / raw)
  To: peterz
  Cc: mingo, vincent.guittot, juri.lelli, dietmar.eggemann, rostedt,
	bsegall, mgorman, bristot, vschneid, linux-kernel, Haifeng Xu

We can't change the weight of the root cgroup. Let's handle
root_task_group before doing any real work including acquiring
the shares_mutex.

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
 kernel/sched/fair.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a80a73909dc2..1ac2df87e070 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12594,6 +12594,9 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
 {
 	int ret;
 
+	if (tg == &root_task_group)
+		return -EINVAL;
+
 	mutex_lock(&shares_mutex);
 	if (tg_is_idle(tg))
 		ret = -EINVAL;
-- 
2.25.1


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

end of thread, other threads:[~2023-09-29 11:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22  9:43 [PATCH] sched: Filter root_task_group at the beginning Haifeng Xu
2023-09-28 21:03 ` Ingo Molnar
2023-09-29 11:56   ` Haifeng Xu

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