Skip to contentSkip to conversation

tick/sched: make kernel parameter skew_tick boolean

PATCH Applied Sergey Shtylyov 2 participants 2 messages Oct 1 – Nov 9 Nohz, dynticks support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tick/sched: make kernel parameter skew_tick boolean

The kernel parameter skew_tick requires an integer value, despite being boolean in nature. Convert the static variable sched_skew_tick to *bool* (while at it, annotate it as __ro_after_init) and thus use kstrtobool() to parse the parameter's value (the values 0 and 1 should keep working as before); also stop ignoring the value parsing errors as it happened before (when skew_tick() always returned 0)...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

---
The patch is against the timers/nohz branch of the tip.git repo.

 kernel/time/tick-sched.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +2 -4
index a7893a079a83..1083eede34fc 100644
@@ -1475,13 +1475,11 @@ void tick_irq_enter(void)
 	tick_nohz_irq_enter();
 }
 
-static int sched_skew_tick;
+static bool sched_skew_tick __ro_after_init;
 
 static int __init skew_tick(char *str)
 {
-	get_option(&str, &sched_skew_tick);
-
-	return 0;
+	return kstrtobool(str, &sched_skew_tick);
 }
 early_param("skew_tick", skew_tick);
 
Signature · 1 line
2.55.0
#1 lore raw

[tip: timers/nohz] tick/sched: Make kernel parameter skew_tick boolean

The following commit has been merged into the timers/nohz branch of tip:

The following commit has been merged into the timers/nohz branch of tip:

Commit-ID:     438b55d86a1a96949355f6b1b17720191937beb4
Gitweb:        https://git.kernel.org/tip/438b55d86a1a96949355f6b1b17720191937beb4
Author:        Sergey Shtylyov <[email protected]>
AuthorDate:    Thu, 01 Oct 2026 23:24:09 +03:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 09 Nov 2026 16:28:35 +01:00

tick/sched: Make kernel parameter skew_tick boolean

The kernel parameter skew_tick requires an integer value, despite being boolean in nature, and the parser functions ignores errors.

Convert the static variable sched_skew_tick to 'bool' and thus use kstrtobool() to parse the parameter's value and return an eventual parser error to the caller. The input values 0 and 1 keep working as before.

As the variable can only be set at boot time mark it __ro_after_init.

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

---
 kernel/time/tick-sched.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +2 -4
index c6d86e4..5e96c2e 100644
@@ -1499,13 +1499,11 @@ void tick_irq_enter(void)
 	tick_nohz_irq_enter();
 }
 
-static int sched_skew_tick;
+static bool sched_skew_tick __ro_after_init;
 
 static int __init skew_tick(char *str)
 {
-	get_option(&str, &sched_skew_tick);
-
-	return 0;
+	return kstrtobool(str, &sched_skew_tick);
 }
 early_param("skew_tick", skew_tick);