kernel/time: move timer sysctls to its own file
Subsystems (3)
PATCH v4 1/1 kernel/time: move timer sysctls to its own file
This moves the kernel/timer/timer.c respective sysctls to its own file.
--- include/linux/timer.h | 4 ---- kernel/sysctl.c | 11 ----------- kernel/time/timer.c | 26 ++++++++++++++++++++++++-- 3 files changed, 24 insertions(+), 17 deletions(-)
include/linux/timer.h +0 -4
@@ -198,10 +198,6 @@ extern enum hrtimer_restart it_real_fn(struct hrtimer *);#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON )struct ctl_table ; - -extern unsigned int sysctl_timer_migration; -int timer_migration_handler (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos);#endif unsigned long __round_jiffies (unsigned long j,int cpu);
kernel/sysctl.c +0 -11
@@ -2292,17 +2292,6 @@ static struct ctl_table kern_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, -#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) - { - .procname = "timer_migration", - .data = &sysctl_timer_migration, - .maxlen = sizeof(unsigned int), - .mode = 0644, - .proc_handler = timer_migration_handler, - .extra1 = SYSCTL_ZERO, - .extra2 = SYSCTL_ONE, - }, -#endif#ifdef CONFIG_BPF_SYSCALL { .procname = "unprivileged_bpf_disabled",
kernel/time/timer.c +24 -2
@@ -44,6 +44,7 @@#include <linux/slab.h> #include <linux/compat.h> #include <linux/random.h> +#include <linux/sysctl.h> #include <linux/uaccess.h> #include <asm/unistd.h>
@@ -223,7 +224,7 @@ static void timer_update_keys(struct work_struct *work); static DECLARE_WORK(timer_update_work, timer_update_keys);#ifdef CONFIG_SMP -unsigned int sysctl_timer_migration =1 ; +static unsigned int sysctl_timer_migration =1 ;DEFINE_STATIC_KEY_FALSE (timers_migration_enabled);
@@ -251,7 +252,8 @@ void timers_update_nohz(void)schedule_work (&timer_update_work); } -int timer_migration_handler (struct ctl_table *table,int write, +#if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON ) +static int timer_migration_handler (struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
@@ -264,6 +266,26 @@ int timer_migration_handler(struct ctl_table *table, int write, return ret; } +static struct ctl_table timer_sysctl[] = { + { + .procname ="timer_migration" , + .data = &sysctl_timer_migration, + .maxlen =sizeof (unsigned int ), + .mode =0644 , + .proc_handler = timer_migration_handler, + .extra1 =SYSCTL_ZERO , + .extra2 =SYSCTL_ONE , + }, + {} +}; + +static int __init timer_sysctl_init (void ) +{ +register_sysctl_init ("kernel" , timer_sysctl); +return 0 ; +} +__initcall (timer_sysctl_init); +#endif static inline bool is_timers_nohz_active (void ) {return static_branch_unlikely (&timers_nohz_active);
Signature · 1 line
2.20.1
Quoted 2 lines · On Mon, Jan 31 2022 at 14:57, [email protected] wrote:
This moves the
kernel/timer/timer.crespective sysctls to its own file.
Why? What's the reason and purpose of this? We are not moving code around just because we can.
Thanks,
tglx
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi tangmeng,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on linus/master kees/for-next/pstore v5.17-rc2 next-20220128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/tangmeng/kernel-time-move-timer-sysctls-to-its-own-file/20220131-145847 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 35e13e9da9afbce13c1d36465504ece4e65f24fe config: arc-randconfig-r043-20220131 (https://download.01.org/0day-ci/archive/20220131/202201311703.8ZHlxEUI-lkp(a)intel.com/config) compiler: arc-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f32d255b81d227c1491a06a5d7b016eb9bd54087
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review tangmeng/kernel-time-move-timer-sysctls-to-its-own-file/20220131-145847 git checkout f32d255b81d227c1491a06a5d7b016eb9bd54087
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash kernel/time/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
kernel/time/timer.c: In function 'timer_sysctl_init':
>> kernel/time/timer.c:284:9: error: implicit declaration of function 'register_sysctl_init'; did you mean 'timer_sysctl_init'? [-Werror=implicit-function-declaration]
284 | register_sysctl_init("kernel", timer_sysctl);
| ^~~~~~~~~~~~~~~~~~~~
| timer_sysctl_init
In file included from include/linux/perf_event.h:25,
from include/linux/trace_events.h:10,
from include/trace/syscall.h:7,
from include/linux/syscalls.h:88,
from kernel/time/timer.c:35:
At top level:
arch/arc/include/asm/perf_event.h:126:27: warning: 'arc_pmu_cache_map' defined but not used [-Wunused-const-variable=]
126 | static const unsigned int arc_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
| ^~~~~~~~~~~~~~~~~
arch/arc/include/asm/perf_event.h:91:27: warning: 'arc_pmu_ev_hw_map' defined but not used [-Wunused-const-variable=]
91 | static const char * const arc_pmu_ev_hw_map[] = {
| ^~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +284 kernel/time/timer.c
281
282 static int __init timer_sysctl_init(void)
283 {
> 284 register_sysctl_init("kernel", timer_sysctl); 285 return 0;
286 }
287 __initcall(timer_sysctl_init);
288 #endif
289 static inline bool is_timers_nohz_active(void)
290 {
291 return static_branch_unlikely(&timers_nohz_active);
292 }
293 #else
294 static inline bool is_timers_nohz_active(void) { return false; }
295 #endif /* NO_HZ_COMMON */
296
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org