public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] sched, cgroup: cgroup1 can also take the non-RUNTIME_INF min
@ 2024-09-10  7:48 Liu Song
  2024-09-10  9:35 ` Michal Koutný
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Liu Song @ 2024-09-10  7:48 UTC (permalink / raw)
  To: tj, lizefan.x, hannes, mkoutny; +Cc: cgroups, linux-kernel, liusong

For the handling logic of child_quota, there is no need to distinguish
between cgroup1 and cgroup2, so unify the handling logic here.

Signed-off-by: Liu Song <liusong@linux.alibaba.com>
---
 kernel/sched/core.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e752146e59a4..8418c67faa69 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -9501,23 +9501,12 @@ static int tg_cfs_schedulable_down(struct task_group *tg, void *data)
 		parent_quota = parent_b->hierarchical_quota;
 
 		/*
-		 * Ensure max(child_quota) <= parent_quota.  On cgroup2,
-		 * always take the non-RUNTIME_INF min.  On cgroup1, only
-		 * inherit when no limit is set. In both cases this is used
-		 * by the scheduler to determine if a given CFS task has a
-		 * bandwidth constraint at some higher level.
+		 * Ensure max(child_quota) <= parent_quota.
 		 */
-		if (cgroup_subsys_on_dfl(cpu_cgrp_subsys)) {
-			if (quota == RUNTIME_INF)
-				quota = parent_quota;
-			else if (parent_quota != RUNTIME_INF)
-				quota = min(quota, parent_quota);
-		} else {
-			if (quota == RUNTIME_INF)
-				quota = parent_quota;
-			else if (parent_quota != RUNTIME_INF && quota > parent_quota)
-				return -EINVAL;
-		}
+		if (quota == RUNTIME_INF)
+			quota = parent_quota;
+		else if (parent_quota != RUNTIME_INF)
+			quota = min(quota, parent_quota);
 	}
 	cfs_b->hierarchical_quota = quota;
 
-- 
2.19.1.6.gb485710b


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

end of thread, other threads:[~2024-09-11  1:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10  7:48 [RFC PATCH] sched, cgroup: cgroup1 can also take the non-RUNTIME_INF min Liu Song
2024-09-10  9:35 ` Michal Koutný
2024-09-10 10:05   ` 刘嵩
2024-09-10 10:49 ` Phil Auld
2024-09-10 11:13   ` 刘嵩
2024-09-10 12:12     ` Phil Auld
2024-09-10 19:32 ` Tejun Heo
2024-09-11  1:53   ` 刘嵩

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