2023-08-24 07:41:43

by Liu Chao

[permalink] [raw]
Subject: [PATCH] sched: Increase MAX_SHARES

When the number of CPUs is large, such as 320 CPUs, create two cgroups in
/sys/fs/cgroup/cpu/: system.slice and machine.slice. system.slice uses 0.5
CPU, and machine.slice uses the reset 319.5 CPUs. The cpu.shares of
system.slice is set to 1024 by default, so in order to achieve this
effect, machine.slice needs to be set to 319.5 * 1024 / 0.5 = 654336,
which is greater than 1<<18, so it is increased to 1<<20.

Signed-off-by: Liu Chao <[email protected]>
---
kernel/sched/sched.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 0f871e9b169c..2cc1cc7dd71a 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -482,7 +482,7 @@ struct task_group {
* limitation from this.)
*/
#define MIN_SHARES (1UL << 1)
-#define MAX_SHARES (1UL << 18)
+#define MAX_SHARES (1UL << 20)
#endif

typedef int (*tg_visitor)(struct task_group *, void *);
--
2.23.0