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: Avoid ktime_get() indirection

The clock of the hrtick and deadline timers is known to be CLOCK_MONOTONIC.
No point in looking it up via hrtimer_cb_get_time().

Just use ktime_get() directly.

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

authored by

Thomas Gleixner and committed by
Peter Zijlstra
d70c1080 5d88e424

+2 -3
+1 -2
kernel/sched/core.c
··· 925 925 */ 926 926 void hrtick_start(struct rq *rq, u64 delay) 927 927 { 928 - struct hrtimer *timer = &rq->hrtick_timer; 929 928 s64 delta; 930 929 931 930 /* ··· 932 933 * doesn't make sense and can cause timer DoS. 933 934 */ 934 935 delta = max_t(s64, delay, 10000LL); 935 - rq->hrtick_time = ktime_add_ns(hrtimer_cb_get_time(timer), delta); 936 + rq->hrtick_time = ktime_add_ns(ktime_get(), delta); 936 937 937 938 if (rq == this_rq()) 938 939 __hrtick_restart(rq);
+1 -1
kernel/sched/deadline.c
··· 1097 1097 act = ns_to_ktime(dl_next_period(dl_se)); 1098 1098 } 1099 1099 1100 - now = hrtimer_cb_get_time(timer); 1100 + now = ktime_get(); 1101 1101 delta = ktime_to_ns(now) - rq_clock(rq); 1102 1102 act = ktime_add_ns(act, delta); 1103 1103