From nobody Tue Jun 30 01:42:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E3A9C433F5 for ; Sun, 30 Jan 2022 15:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355392AbiA3POh (ORCPT ); Sun, 30 Jan 2022 10:14:37 -0500 Received: from smtpbgjp3.qq.com ([54.92.39.34]:34876 "EHLO smtpbgjp3.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349175AbiA3POg (ORCPT ); Sun, 30 Jan 2022 10:14:36 -0500 X-QQ-mid: bizesmtp42t1643555661tvf2j5vv Received: from localhost.localdomain (unknown [180.105.58.61]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 30 Jan 2022 23:14:12 +0800 (CST) X-QQ-SSF: 01400000002000B0E000B00A0000000 X-QQ-FEAT: awo/irkzQ9x7uCJ7hJ2L2ByOwJx57RTcgS8GnflcG+562cie6+uqZolaa1riz 5XSqAxZU5rcs2SjiB0xEVGQ91FJfTnyXaQO4KhzVPv/w9eVaN538WHS3+OhRNPyPcMozUax DEhT2g9jT3A+ep+/QY+t+8D9aCd2Nm5YJ1MG7wRhoio+3qjC16fQPQ1JYdsQ/lH70ZGntuJ F90/Jlt+ejtHdbKs8CZmyTVDtIm41pIiNOo4SB0qSYK12BvuGp8U5z/hDgMzxBeFTKPmFzm roCxLMoy/+15Txxc3G10vwxmQCg8Yq1pUN+3MlB7e8yl6YbiJUTV9tHbRdlb9LjlyGbQRVr BVnkto3wPVy9Xnr6dbZgBAmw0ENAw== X-QQ-GoodBg: 2 From: tangmeng To: tglx@linutronix.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, john.stultz@linaro.org, sboyd@kernel.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, tangmeng Subject: [PATCH v3] kernel/time: move timer sysctls to its own file Date: Sun, 30 Jan 2022 23:13:38 +0800 Message-Id: <20220130151338.6533-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This moves the kernel/timer/timer.c respective sysctls to its own file. Signed-off-by: tangmeng Reported-by: kernel test robot --- include/linux/timer.h | 4 ---- kernel/sysctl.c | 11 ----------- kernel/time/timer.c | 28 ++++++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index fda13c9d1256..793b6b7c5a3e 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -198,10 +198,6 @@ extern enum hrtimer_restart it_real_fn(struct hrtimer = *); =20 #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 =20 unsigned long __round_jiffies(unsigned long j, int cpu); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 5ae443b2882e..d6d133423e5d 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2292,17 +2292,6 @@ static struct ctl_table kern_table[] =3D { .extra1 =3D SYSCTL_ZERO, .extra2 =3D SYSCTL_ONE, }, -#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) - { - .procname =3D "timer_migration", - .data =3D &sysctl_timer_migration, - .maxlen =3D sizeof(unsigned int), - .mode =3D 0644, - .proc_handler =3D timer_migration_handler, - .extra1 =3D SYSCTL_ZERO, - .extra2 =3D SYSCTL_ONE, - }, -#endif #ifdef CONFIG_BPF_SYSCALL { .procname =3D "unprivileged_bpf_disabled", diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 85f1021ad459..f9ae2b4f6326 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -44,6 +44,7 @@ #include #include #include +#include =20 #include #include @@ -223,7 +224,7 @@ static void timer_update_keys(struct work_struct *work); static DECLARE_WORK(timer_update_work, timer_update_keys); =20 #ifdef CONFIG_SMP -unsigned int sysctl_timer_migration =3D 1; +static unsigned int sysctl_timer_migration =3D 1; =20 DEFINE_STATIC_KEY_FALSE(timers_migration_enabled); =20 @@ -251,7 +252,8 @@ void timers_update_nohz(void) schedule_work(&timer_update_work); } =20 -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,27 @@ int timer_migration_handler(struct ctl_table *table, i= nt write, return ret; } =20 +static struct ctl_table timer_sysctl[] =3D { + { + .procname =3D "timer_migration", + .data =3D &sysctl_timer_migration, + .maxlen =3D sizeof(unsigned int), + .mode =3D 0644, + .proc_handler =3D timer_migration_handler, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, + }, + {} +}; + +static int __init timer_sysctl_init(void) +{ + register_sysctl_init("kernel", timer_sysctl); + return 0; +} +#else +#define timer_sysctl_init() do { } while (0) +#endif static inline bool is_timers_nohz_active(void) { return static_branch_unlikely(&timers_nohz_active); @@ -2022,6 +2045,7 @@ void __init init_timers(void) init_timer_cpus(); posix_cputimers_init_work(); open_softirq(TIMER_SOFTIRQ, run_timer_softirq); + timer_sysctl_init(); } =20 /** --=20 2.20.1