hrtimer: Some header cleanups
cover hrtimer: Some header cleanups
Remove some definitions from the global linux/hrtimer.h header.
---
Thomas Weißschuh (3):
hrtimer: Remove unused resolution constants
hrtimer: Remove public definition of HIGH_RES_NSEC
hrtimer: Drop _tv64() helpers
include/linux/hrtimer.h | 15 --------------- include/linux/hrtimer_defs.h | 20 -------------------- kernel/time/hrtimer.c | 14 +++++++++++--- 3 files changed, 11 insertions(+), 38 deletions(-)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20260105-hrtimer-header-cleanup-e55d98e811f8
Best regards,
Signature · 1 line
Thomas Weißschuh <[email protected]>
PATCH 1/3 hrtimer: Remove unused resolution constants
These constants are never used, remove them.
--- include/linux/hrtimer_defs.h | 8 -------- 1 file changed, 8 deletions(-)
include/linux/hrtimer_defs.h +0 -8
@@ -15,14 +15,6 @@* this resolution values. */ # define HIGH_RES_NSEC 1 -# define KTIME_HIGH_RES (HIGH_RES_NSEC) -# define MONOTONIC_RES_NSEC HIGH_RES_NSEC -# define KTIME_MONOTONIC_RES KTIME_HIGH_RES - -#else - -# define MONOTONIC_RES_NSEC LOW_RES_NSEC -# define KTIME_MONOTONIC_RES KTIME_LOW_RES#endif
Signature · 1 line
2.52.0
[tip: timers/core] hrtimer: Remove unused resolution constants
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 0483e5e1dc78f53c540b19231e9cf5571ce01d50 Gitweb: https://git.kernel.org/tip/0483e5e1dc78f53c540b19231e9cf5571ce01d50 Author: Thomas Weißschuh <[email protected]> AuthorDate: Wed, 07 Jan 2026 11:36:56 +01:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 13 Jan 2026 11:05:48 +01:00
hrtimer: Remove unused resolution constants
These constants are never used, remove them.
--- include/linux/hrtimer_defs.h | 8 -------- 1 file changed, 8 deletions(-)
include/linux/hrtimer_defs.h +0 -8
@@ -15,14 +15,6 @@* this resolution values. */ # define HIGH_RES_NSEC 1 -# define KTIME_HIGH_RES (HIGH_RES_NSEC) -# define MONOTONIC_RES_NSEC HIGH_RES_NSEC -# define KTIME_MONOTONIC_RES KTIME_HIGH_RES - -#else - -# define MONOTONIC_RES_NSEC LOW_RES_NSEC -# define KTIME_MONOTONIC_RES KTIME_LOW_RES#endif
PATCH 2/3 hrtimer: Remove public definition of HIGH_RES_NSEC
In reply to Thomas WeißschuhThis constant is only used in a single place and is has a very generic name polluting the global namespace.
Move the constant closer to its only user.
--- include/linux/hrtimer_defs.h | 12 ------------ kernel/time/hrtimer.c | 8 ++++++++ 2 files changed, 8 insertions(+), 12 deletions(-)
include/linux/hrtimer_defs.h +0 -12
@@ -6,18 +6,6 @@#include <linux/timerqueue.h> #include <linux/seqlock.h> -#ifdef CONFIG_HIGH_RES_TIMERS - -/* -* The resolution of the clocks. The resolution value is returned in -* the clock_getres() system call to give application programmers an -* idea of the (in)accuracy of timers. Timer values are rounded up to -* this resolution values. -*/ -# define HIGH_RES_NSEC 1 - -#endif -#ifdef CONFIG_64BIT # define __hrtimer_clock_base_align ____cacheline_aligned#else
kernel/time/hrtimer.c +8 -0
@@ -49,6 +49,14 @@#include "tick-internal.h" +/* +* The resolution of the clocks. The resolution value is returned in +* the clock_getres() system call to give application programmers an +* idea of the (in)accuracy of timers. Timer values are rounded up to +* this resolution values. +*/ +#define HIGH_RES_NSEC 1 +/* * Masks for selecting the soft and hard context timers from * cpu_base->active
Signature · 1 line
2.52.0
[tip: timers/core] hrtimer: Remove public definition of HIGH_RES_NSEC
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 84663a5ad6333e8dcb57be9bb113f592e05b33c6 Gitweb: https://git.kernel.org/tip/84663a5ad6333e8dcb57be9bb113f592e05b33c6 Author: Thomas Weißschuh <[email protected]> AuthorDate: Wed, 07 Jan 2026 11:36:57 +01:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 13 Jan 2026 11:05:48 +01:00
hrtimer: Remove public definition of HIGH_RES_NSEC
This constant is only used in a single place and is has a very generic name polluting the global namespace.
Move the constant closer to its only user.
--- include/linux/hrtimer_defs.h | 12 ------------ kernel/time/hrtimer.c | 8 ++++++++ 2 files changed, 8 insertions(+), 12 deletions(-)
include/linux/hrtimer_defs.h +0 -12
@@ -6,18 +6,6 @@#include <linux/timerqueue.h> #include <linux/seqlock.h> -#ifdef CONFIG_HIGH_RES_TIMERS - -/* -* The resolution of the clocks. The resolution value is returned in -* the clock_getres() system call to give application programmers an -* idea of the (in)accuracy of timers. Timer values are rounded up to -* this resolution values. -*/ -# define HIGH_RES_NSEC 1 - -#endif -#ifdef CONFIG_64BIT # define __hrtimer_clock_base_align ____cacheline_aligned#else
kernel/time/hrtimer.c +8 -0
@@ -50,6 +50,14 @@#include "tick-internal.h" /* +* The resolution of the clocks. The resolution value is returned in +* the clock_getres() system call to give application programmers an +* idea of the (in)accuracy of timers. Timer values are rounded up to +* this resolution values. +*/ +#define HIGH_RES_NSEC 1 + +/* * Masks for selecting the soft and hard context timers from * cpu_base->active */
PATCH 3/3 hrtimer: Drop _tv64() helpers
In reply to Thomas WeißschuhSince ktime_t has become an alias to s64, these helpers are unnecessary.
Migrate the few remaining users to the regular helpers and remove the now dead code.
--- include/linux/hrtimer.h | 15 --------------- kernel/time/hrtimer.c | 6 +++--- 2 files changed, 3 insertions(+), 18 deletions(-)
include/linux/hrtimer.h +0 -15
@@ -112,12 +112,6 @@ static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t t timer->node.expires =ktime_add_safe (time,ns_to_ktime (delta)); } -static inline void hrtimer_set_expires_tv64 (struct hrtimer *timer,s64 tv64) -{ - timer->node.expires = tv64; - timer->_softexpires = tv64; -} -static inline void hrtimer_add_expires (struct hrtimer *timer,ktime_t time) { timer->node.expires =ktime_add_safe (timer->node.expires, time);
@@ -140,15 +134,6 @@ static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)return timer->_softexpires; } -static inline s64 hrtimer_get_expires_tv64 (const struct hrtimer *timer) -{ -return timer->node.expires; -} -static inline s64 hrtimer_get_softexpires_tv64 (const struct hrtimer *timer) -{ -return timer->_softexpires; -} -static inline s64 hrtimer_get_expires_ns (const struct hrtimer *timer) {return ktime_to_ns (timer->node.expires);
kernel/time/hrtimer.c +3 -3
@@ -814,7 +814,7 @@ static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram)struct hrtimer_clock_base *base = timer->base;ktime_t expires =ktime_sub (hrtimer_get_expires (timer), base->offset); -WARN_ON_ONCE (hrtimer_get_expires_tv64 (timer) <0 ); +WARN_ON_ONCE (hrtimer_get_expires (timer) <0 );/* * CLOCK_REALTIME timer might be requested with an absolute
@@ -1061,7 +1061,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) orun =ktime_divns (delta, incr);hrtimer_add_expires_ns (timer, incr * orun); -if (hrtimer_get_expires_tv64 (timer) > now) +if (hrtimer_get_expires (timer) > now)return orun;/* * This (and the ktime_add() below) is the
@@ -1843,7 +1843,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now,* are right-of a not yet expired timer, because that * timer will have to trigger a wakeup anyway. */ -if (basenow <hrtimer_get_softexpires_tv64 (timer)) +if (basenow <hrtimer_get_softexpires (timer))break ;__run_hrtimer (cpu_base, base, timer, &basenow, flags);
Signature · 1 line
2.52.0
[tip: timers/core] hrtimer: Drop _tv64() helpers
The following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: ae4535b0d9372ca90a24f2d9970310ee48eb3cc2 Gitweb: https://git.kernel.org/tip/ae4535b0d9372ca90a24f2d9970310ee48eb3cc2 Author: Thomas Weißschuh <[email protected]> AuthorDate: Wed, 07 Jan 2026 11:36:58 +01:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 13 Jan 2026 11:05:49 +01:00
hrtimer: Drop _tv64() helpers
Since ktime_t has become an alias to s64, these helpers are unnecessary.
Migrate the few remaining users to the regular helpers and remove the now dead code.
--- include/linux/hrtimer.h | 15 --------------- kernel/time/hrtimer.c | 6 +++--- 2 files changed, 3 insertions(+), 18 deletions(-)
include/linux/hrtimer.h +0 -15
@@ -112,12 +112,6 @@ static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t t timer->node.expires =ktime_add_safe (time,ns_to_ktime (delta)); } -static inline void hrtimer_set_expires_tv64 (struct hrtimer *timer,s64 tv64) -{ - timer->node.expires = tv64; - timer->_softexpires = tv64; -} -static inline void hrtimer_add_expires (struct hrtimer *timer,ktime_t time) { timer->node.expires =ktime_add_safe (timer->node.expires, time);
@@ -140,15 +134,6 @@ static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)return timer->_softexpires; } -static inline s64 hrtimer_get_expires_tv64 (const struct hrtimer *timer) -{ -return timer->node.expires; -} -static inline s64 hrtimer_get_softexpires_tv64 (const struct hrtimer *timer) -{ -return timer->_softexpires; -} -static inline s64 hrtimer_get_expires_ns (const struct hrtimer *timer) {return ktime_to_ns (timer->node.expires);
kernel/time/hrtimer.c +3 -3
@@ -814,7 +814,7 @@ static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram)struct hrtimer_clock_base *base = timer->base;ktime_t expires =ktime_sub (hrtimer_get_expires (timer), base->offset); -WARN_ON_ONCE (hrtimer_get_expires_tv64 (timer) <0 ); +WARN_ON_ONCE (hrtimer_get_expires (timer) <0 );/* * CLOCK_REALTIME timer might be requested with an absolute
@@ -1061,7 +1061,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) orun =ktime_divns (delta, incr);hrtimer_add_expires_ns (timer, incr * orun); -if (hrtimer_get_expires_tv64 (timer) > now) +if (hrtimer_get_expires (timer) > now)return orun;/* * This (and the ktime_add() below) is the
@@ -1843,7 +1843,7 @@ static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now,* are right-of a not yet expired timer, because that * timer will have to trigger a wakeup anyway. */ -if (basenow <hrtimer_get_softexpires_tv64 (timer)) +if (basenow <hrtimer_get_softexpires (timer))break ;__run_hrtimer (cpu_base, base, timer, &basenow, flags);