summaryrefslogtreecommitdiffstats
path: root/kernel/sched/autogroup.c
diff options
context:
space:
mode:
authorZhen Ni <nizhen@uniontech.com>2022-01-28 10:50:25 +0100
committerPeter Zijlstra <peterz@infradead.org>2022-02-02 13:11:37 +0100
commitc8eaf6ac76f40f6c59fc7d056e2e08c4a57ea9c7 (patch)
treeda3e3596be1253da7ec326611367490d4c7a808c /kernel/sched/autogroup.c
parentselftests/rseq: x86-32: use %gs segment selector for accessing rseq thread area (diff)
downloadlinux-c8eaf6ac76f40f6c59fc7d056e2e08c4a57ea9c7.tar.xz
linux-c8eaf6ac76f40f6c59fc7d056e2e08c4a57ea9c7.zip
sched: move autogroup sysctls into its own file
move autogroup sysctls to autogroup.c and use the new register_sysctl_init() to register the sysctl interface. Signed-off-by: Zhen Ni <nizhen@uniontech.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20220128095025.8745-1-nizhen@uniontech.com
Diffstat (limited to 'kernel/sched/autogroup.c')
-rw-r--r--kernel/sched/autogroup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/sched/autogroup.c b/kernel/sched/autogroup.c
index 8629b37d118e..31dd2593145e 100644
--- a/kernel/sched/autogroup.c
+++ b/kernel/sched/autogroup.c
@@ -9,6 +9,28 @@ unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1;
static struct autogroup autogroup_default;
static atomic_t autogroup_seq_nr;
+#ifdef CONFIG_SYSCTL
+static struct ctl_table sched_autogroup_sysctls[] = {
+ {
+ .procname = "sched_autogroup_enabled",
+ .data = &sysctl_sched_autogroup_enabled,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+ {}
+};
+
+static void __init sched_autogroup_sysctl_init(void)
+{
+ register_sysctl_init("kernel", sched_autogroup_sysctls);
+}
+#else
+#define sched_autogroup_sysctl_init() do { } while (0)
+#endif
+
void __init autogroup_init(struct task_struct *init_task)
{
autogroup_default.tg = &root_task_group;
@@ -198,6 +220,7 @@ void sched_autogroup_exit(struct signal_struct *sig)
static int __init setup_autogroup(char *str)
{
sysctl_sched_autogroup_enabled = 0;
+ sched_autogroup_sysctl_init();
return 1;
}