From 8b42012dc4aa0008ad10cf7575f684ebc3a587cf Mon Sep 17 00:00:00 2001 From: Alexandre Frade Date: Wed, 15 Jun 2022 17:07:29 +0000 Subject: [PATCH 15/19] XANMOD: sched/autogroup: Add kernel parameter and config option to enable/disable autogroup feature by default Signed-off-by: Alexandre Frade --- Documentation/admin-guide/kernel-parameters.txt | 6 ++++-- init/Kconfig | 12 ++++++++++++ kernel/sched/autogroup.c | 9 ++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -493,6 +493,10 @@ Format: (must be >=0) Default: 64 + autogroup= [KNL] Enable or disable scheduler automatic task group + creation. + Format: + bau= [X86_UV] Enable the BAU on SGI UV. The default behavior is to disable the BAU (i.e. bau=0). Format: { "0" | "1" } @@ -3835,8 +3839,6 @@ noapic [SMP,APIC,EARLY] Tells the kernel to not make use of any IOAPICs that may be present in the system. - noautogroup Disable scheduler automatic task group creation. - nocache [ARM,EARLY] no_console_suspend --- a/init/Kconfig +++ b/init/Kconfig @@ -1309,6 +1309,18 @@ config SCHED_AUTOGROUP desktop applications. Task group autogeneration is currently based upon task session. +config SCHED_AUTOGROUP_DEFAULT_ENABLED + bool "Enable automatic process group scheduling feature" + default y + depends on SCHED_AUTOGROUP + help + If set, automatic process group scheduling will be enabled per + default but can be disabled through passing autogroup=0 on the + kernel commandline during boot or a value of 0 via the file + proc/sys/kernel/sched_autogroup_enabled. + + If unsure say Y. + config RELAY bool "Kernel->user space relay support (formerly relayfs)" select IRQ_WORK --- a/kernel/sched/autogroup.c +++ b/kernel/sched/autogroup.c @@ -4,7 +4,8 @@ * Auto-group scheduling implementation: */ -unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1; +unsigned int __read_mostly sysctl_sched_autogroup_enabled = + IS_ENABLED(CONFIG_SCHED_AUTOGROUP_DEFAULT_ENABLED) ? 1 : 0; static struct autogroup autogroup_default; static atomic_t autogroup_seq_nr; @@ -219,11 +220,13 @@ void sched_autogroup_exit(struct signal_ static int __init setup_autogroup(char *str) { - sysctl_sched_autogroup_enabled = 0; + unsigned long enabled; + if (!kstrtoul(str, 0, &enabled)) + sysctl_sched_autogroup_enabled = enabled ? 1 : 0; return 1; } -__setup("noautogroup", setup_autogroup); +__setup("autogroup=", setup_autogroup); #ifdef CONFIG_PROC_FS