From: Zhen Ni <nizhen@uniontech.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, mcgrof@kernel.org,
keescook@chromium.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Zhen Ni <nizhen@uniontech.com>
Subject: [PATCH v3 8/8] sched: Move energy_aware sysctls to topology.c
Date: Tue, 15 Feb 2022 19:46:04 +0800 [thread overview]
Message-ID: <20220215114604.25772-9-nizhen@uniontech.com> (raw)
In-Reply-To: <20220215114604.25772-1-nizhen@uniontech.com>
move energy_aware sysctls to topology.c and use the new
register_sysctl_init() to register the sysctl interface.
Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
include/linux/sched/sysctl.h | 6 ------
kernel/sched/topology.c | 25 +++++++++++++++++++++++--
kernel/sysctl.c | 11 -----------
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 053688eafd51..b6a4063e388d 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -24,10 +24,4 @@ enum sched_tunable_scaling {
int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
size_t *lenp, loff_t *ppos);
-#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
-extern unsigned int sysctl_sched_energy_aware;
-int sched_energy_aware_handler(struct ctl_table *table, int write,
- void *buffer, size_t *lenp, loff_t *ppos);
-#endif
-
#endif /* _LINUX_SCHED_SYSCTL_H */
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index d201a7052a29..409e27af2034 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -207,7 +207,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
DEFINE_STATIC_KEY_FALSE(sched_energy_present);
-unsigned int sysctl_sched_energy_aware = 1;
+static unsigned int sysctl_sched_energy_aware = 1;
DEFINE_MUTEX(sched_energy_mutex);
bool sched_energy_update;
@@ -221,7 +221,7 @@ void rebuild_sched_domains_energy(void)
}
#ifdef CONFIG_PROC_SYSCTL
-int sched_energy_aware_handler(struct ctl_table *table, int write,
+static int sched_energy_aware_handler(struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
int ret, state;
@@ -238,6 +238,27 @@ int sched_energy_aware_handler(struct ctl_table *table, int write,
return ret;
}
+
+static struct ctl_table sched_energy_aware_sysctls[] = {
+ {
+ .procname = "sched_energy_aware",
+ .data = &sysctl_sched_energy_aware,
+ .maxlen = sizeof(unsigned int),
+ .mode = 0644,
+ .proc_handler = sched_energy_aware_handler,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE,
+ },
+ {}
+};
+
+static int __init sched_energy_aware_sysctl_init(void)
+{
+ register_sysctl_init("kernel", sched_energy_aware_sysctls);
+ return 0;
+}
+
+late_initcall(sched_energy_aware_sysctl_init);
#endif
static void free_pd(struct perf_domain *pd)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 21b797906cc4..ee6701ea73ea 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1674,17 +1674,6 @@ static struct ctl_table kern_table[] = {
.extra2 = SYSCTL_ONE,
},
#endif /* CONFIG_NUMA_BALANCING */
-#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
- {
- .procname = "sched_energy_aware",
- .data = &sysctl_sched_energy_aware,
- .maxlen = sizeof(unsigned int),
- .mode = 0644,
- .proc_handler = sched_energy_aware_handler,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
- },
-#endif
#ifdef CONFIG_PROVE_LOCKING
{
.procname = "prove_locking",
--
2.20.1
next prev parent reply other threads:[~2022-02-15 11:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 11:45 [PATCH v3 0/8] sched: Move a series of sysctls starting with sys/kernel/sched_* Zhen Ni
2022-02-15 11:45 ` [PATCH v3 1/8] sched: Move child_runs_first sysctls to fair.c Zhen Ni
2022-02-15 11:45 ` [PATCH v3 2/8] sched: Move schedstats sysctls to core.c Zhen Ni
2022-02-15 11:45 ` [PATCH v3 3/8] sched: Move rt_period/runtime sysctls to rt.c Zhen Ni
2022-02-15 11:46 ` [PATCH v3 4/8] sched: Move deadline_period sysctls to deadline.c Zhen Ni
2022-02-15 11:46 ` [PATCH v3 5/8] sched: Move rr_timeslice sysctls to rt.c Zhen Ni
2022-02-15 11:46 ` [PATCH v3 6/8] sched: Move uclamp_util sysctls to core.c Zhen Ni
2022-02-15 11:46 ` [PATCH v3 7/8] sched: Move cfs_bandwidth_slice sysctls to fair.c Zhen Ni
2022-02-15 11:46 ` Zhen Ni [this message]
2022-02-17 7:51 ` [PATCH v3 0/8] sched: Move a series of sysctls starting with sys/kernel/sched_* Luis Chamberlain
2022-02-18 2:52 ` Andrew Morton
2022-02-18 18:21 ` Luis Chamberlain
2022-02-20 0:05 ` Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220215114604.25772-9-nizhen@uniontech.com \
--to=nizhen@uniontech.com \
--cc=juri.lelli@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox