diff options
| author | Ingo Molnar <mingo@kernel.org> | 2026-03-21 08:02:36 +0100 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2026-03-21 08:02:36 +0100 |
| commit | f6472b17933f9adb825e7c7da31f7b7b2edb1950 (patch) | |
| tree | 84cca5e27843ed65fd49e62352d0a1de582470be /include/linux/jiffies.h | |
| parent | 763aacf86f1baefb134c70813aa8c72d1675d738 (diff) | |
| parent | f338e77383789c0cae23ca3d48adcc5e9e137e3c (diff) | |
| download | linux-next-f6472b17933f9adb825e7c7da31f7b7b2edb1950.tar.gz linux-next-f6472b17933f9adb825e7c7da31f7b7b2edb1950.zip | |
Merge tag 'v7.0-rc4' into timers/core, to resolve conflict
Resolve conflict between this change in the upstream kernel:
4c652a47722f ("rseq: Mark rseq_arm_slice_extension_timer() __always_inline")
... and this pending change in timers/core:
0e98eb14814e ("entry: Prepare for deferred hrtimer rearming")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/jiffies.h')
| -rw-r--r-- | include/linux/jiffies.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 1a393d160420..bbd57061802c 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -430,8 +430,44 @@ extern unsigned long preset_lpj; /* * Convert various time units to each other: */ -extern unsigned int jiffies_to_msecs(const unsigned long j); -extern unsigned int jiffies_to_usecs(const unsigned long j); + +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) +/** + * jiffies_to_msecs - Convert jiffies to milliseconds + * @j: jiffies value + * + * This inline version takes care of HZ in {100,250,1000}. + * + * Return: milliseconds value + */ +static inline unsigned int jiffies_to_msecs(const unsigned long j) +{ + return (MSEC_PER_SEC / HZ) * j; +} +#else +unsigned int jiffies_to_msecs(const unsigned long j); +#endif + +#if !(USEC_PER_SEC % HZ) +/** + * jiffies_to_usecs - Convert jiffies to microseconds + * @j: jiffies value + * + * Return: microseconds value + */ +static inline unsigned int jiffies_to_usecs(const unsigned long j) +{ + /* + * Hz usually doesn't go much further MSEC_PER_SEC. + * jiffies_to_usecs() and usecs_to_jiffies() depend on that. + */ + BUILD_BUG_ON(HZ > USEC_PER_SEC); + + return (USEC_PER_SEC / HZ) * j; +} +#else +unsigned int jiffies_to_usecs(const unsigned long j); +#endif /** * jiffies_to_nsecs - Convert jiffies to nanoseconds |
