Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched: Use hrtimer_highres_enabled()

Use the static branch based variant and thereby avoid following three
pointers.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260224163429.203610956@kernel.org

authored by

Thomas Gleixner and committed by
Peter Zijlstra
c3a92213 0a93d308

+9 -34
-6
include/linux/hrtimer.h
··· 146 146 return ktime_sub(timer->node.expires, hrtimer_cb_get_time(timer)); 147 147 } 148 148 149 - static inline int hrtimer_is_hres_active(struct hrtimer *timer) 150 - { 151 - return IS_ENABLED(CONFIG_HIGH_RES_TIMERS) ? 152 - timer->base->cpu_base->hres_active : 0; 153 - } 154 - 155 149 #ifdef CONFIG_HIGH_RES_TIMERS 156 150 extern unsigned int hrtimer_resolution; 157 151 struct clock_event_device;
+9 -28
kernel/sched/sched.h
··· 3019 3019 * - enabled by features 3020 3020 * - hrtimer is actually high res 3021 3021 */ 3022 - static inline int hrtick_enabled(struct rq *rq) 3022 + static inline bool hrtick_enabled(struct rq *rq) 3023 3023 { 3024 - if (!cpu_active(cpu_of(rq))) 3025 - return 0; 3026 - return hrtimer_is_hres_active(&rq->hrtick_timer); 3024 + return cpu_active(cpu_of(rq)) && hrtimer_highres_enabled(); 3027 3025 } 3028 3026 3029 - static inline int hrtick_enabled_fair(struct rq *rq) 3027 + static inline bool hrtick_enabled_fair(struct rq *rq) 3030 3028 { 3031 - if (!sched_feat(HRTICK)) 3032 - return 0; 3033 - return hrtick_enabled(rq); 3029 + return sched_feat(HRTICK) && hrtick_enabled(rq); 3034 3030 } 3035 3031 3036 - static inline int hrtick_enabled_dl(struct rq *rq) 3032 + static inline bool hrtick_enabled_dl(struct rq *rq) 3037 3033 { 3038 - if (!sched_feat(HRTICK_DL)) 3039 - return 0; 3040 - return hrtick_enabled(rq); 3034 + return sched_feat(HRTICK_DL) && hrtick_enabled(rq); 3041 3035 } 3042 3036 3043 3037 extern void hrtick_start(struct rq *rq, u64 delay); ··· 3041 3047 } 3042 3048 3043 3049 #else /* !CONFIG_SCHED_HRTICK: */ 3044 - 3045 - static inline int hrtick_enabled_fair(struct rq *rq) 3046 - { 3047 - return 0; 3048 - } 3049 - 3050 - static inline int hrtick_enabled_dl(struct rq *rq) 3051 - { 3052 - return 0; 3053 - } 3054 - 3055 - static inline int hrtick_enabled(struct rq *rq) 3056 - { 3057 - return 0; 3058 - } 3059 - 3050 + static inline bool hrtick_enabled_fair(struct rq *rq) { return false; } 3051 + static inline bool hrtick_enabled_dl(struct rq *rq) { return false; } 3052 + static inline bool hrtick_enabled(struct rq *rq) { return false; } 3060 3053 #endif /* !CONFIG_SCHED_HRTICK */ 3061 3054 3062 3055 #ifndef arch_scale_freq_tick