Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2355729pxb; Sun, 30 Jan 2022 13:24:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEsNl89744dTTxL6C53lSbvuCko+D9kQmu9oKYqSavXFeYTI2cED3P+e7HypRe9KM+8NOK X-Received: by 2002:a65:57cf:: with SMTP id q15mr14363415pgr.307.1643577863434; Sun, 30 Jan 2022 13:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643577863; cv=none; d=google.com; s=arc-20160816; b=0A2Anu84fmO6rqgAoMY4VEPFG8y7Cf9u05juOcM9NxWX2Y1plKatMOi1h2IK1VZR+3 TKUdJ/iK4+fOLPfwlXEVXJcAI1dHNtdwKBjhKLmL8TQjlvC0H2tpQJU7zQRVpUDFjyDY sQV6EIcoiuJXT2f1SH14xaPQsfrMidOpauUTKY76oacuHKjcfAiereqYl4weECF/fQ5d xJD5e4Z/SkysCeL46bc1OgaRrlUSrFkK7fSp3zBmvjfWXUHm3vy5NdLbSxJCuK58L9zx Z/Th9Nseq045U2BMqr3K6PNsrP5zflau3m/qkB6c6TwEVwHRkrxsTUC4d2FbkjebFtpd tv2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=ErEIYW50bGaYlMbLm1UXQpprH4g+D1sIHeT8/CJE+o8=; b=jQ1hwE9R/a67qFNczuvX4sKb3sOR2s8qGaYpmIMGDIqsAKGuvKGRDE465dRSzSp4Ky t4X33e2Qvhz72nzySH29pbz3I2K+bvk0jEP62E+6wgxCUKQGKn0o4oKJfuuzuEqKUTDy CTWMX6rZOgV67jXng8fu7KRfJUOlqyYfz+cG+HHAcbr8zOJuui5Nyj86igncmL4G1qjq UQZCxaOcbwFmC0QZs1N3VvodWMr42tXdn9Z62nMD6w/gjxODmpcdyNljYwQSpt0YjANK 1PgvwC/ZNgNVE2AkXwqQP2mnwWtn14YYM7gXQ10nbGEjYxRIJhNMEjUrLNA5xc6EoxzH eSUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si13754421pfc.51.2022.01.30.13.23.58; Sun, 30 Jan 2022 13:24:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238481AbiA1JvB (ORCPT + 99 others); Fri, 28 Jan 2022 04:51:01 -0500 Received: from smtpbguseast3.qq.com ([54.243.244.52]:45941 "EHLO smtpbguseast3.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243580AbiA1JvB (ORCPT ); Fri, 28 Jan 2022 04:51:01 -0500 X-QQ-mid: bizesmtp16t1643363449tqcolhvo Received: from localhost.localdomain (unknown [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jan 2022 17:50:29 +0800 (CST) X-QQ-SSF: 0140000000200000B000B00A0000000 X-QQ-FEAT: dpyQmELDBxH9OJnSTX2OZ9jR1M94PHaAk870PQvL60zkQ6X7Dy7qLmCAK4wVQ GLtkEl1gmLr+BvpdbZ1+imPzzhV7w62ToKPFmYz9l/hwf8MPaIMvYfINdHtArZPDUxf4sFp kF/YvsbQ0zeHcc3Z7xSyJnUmGG0is1nYxjuLPj9fsyxh0F6MlNOUTS+EHAh9Fs+Hnu/XGZU QLeMGccBGx4Io9DsD53edTMaVnPdDfPAZ0BhZvvqmXmBP66SgCu5UlZru7V6lZSOKQl5WAv Ew5Os30G7cDlXe3iXdULYpUE4NAh6cNosFp2D6pHW2PaupM30Xjh+lGxUzn3/DiFSx3oqXm S/2yq94LEp3kmTIuW4= X-QQ-GoodBg: 2 From: Zhen Ni To: mingo@redhat.com Cc: peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Zhen Ni Subject: [PATCH] sched: move autogroup sysctls into its own file Date: Fri, 28 Jan 2022 17:50:25 +0800 Message-Id: <20220128095025.8745-1-nizhen@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org move autogroup sysctls to autogroup.c and use the new register_sysctl_init() to register the sysctl interface. Signed-off-by: Zhen Ni --- include/linux/sched/sysctl.h | 4 ---- kernel/sched/autogroup.c | 23 +++++++++++++++++++++++ kernel/sched/autogroup.h | 1 + kernel/sysctl.c | 11 ----------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index c19dd5a2c05c..3f2b70f8d32c 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -45,10 +45,6 @@ extern unsigned int sysctl_sched_uclamp_util_min_rt_default; extern unsigned int sysctl_sched_cfs_bandwidth_slice; #endif -#ifdef CONFIG_SCHED_AUTOGROUP -extern unsigned int sysctl_sched_autogroup_enabled; -#endif - extern int sysctl_sched_rr_timeslice; extern int sched_rr_timeslice; 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; } diff --git a/kernel/sched/autogroup.h b/kernel/sched/autogroup.h index b96419974a1f..90fcbfdd70c3 100644 --- a/kernel/sched/autogroup.h +++ b/kernel/sched/autogroup.h @@ -27,6 +27,7 @@ extern bool task_wants_autogroup(struct task_struct *p, struct task_group *tg); static inline struct task_group * autogroup_task_group(struct task_struct *p, struct task_group *tg) { + extern unsigned int sysctl_sched_autogroup_enabled; int enabled = READ_ONCE(sysctl_sched_autogroup_enabled); if (enabled && task_wants_autogroup(p, tg)) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 5ae443b2882e..1cb7ca68cd4e 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1750,17 +1750,6 @@ static struct ctl_table kern_table[] = { .proc_handler = sysctl_sched_uclamp_handler, }, #endif -#ifdef CONFIG_SCHED_AUTOGROUP - { - .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, - }, -#endif #ifdef CONFIG_CFS_BANDWIDTH { .procname = "sched_cfs_bandwidth_slice_us", -- 2.20.1