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.

hrtimer: Simplify run_hrtimer_queues()

Replace the open coded container_of() orgy with a trivial
clock_base_next_timer() helper.

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

authored by

Thomas Gleixner and committed by
Peter Zijlstra
a64ad57e 2bd1cc24

+10 -9
+10 -9
kernel/time/hrtimer.c
··· 1933 1933 base->running = NULL; 1934 1934 } 1935 1935 1936 + static __always_inline struct hrtimer *clock_base_next_timer_safe(struct hrtimer_clock_base *base) 1937 + { 1938 + struct timerqueue_node *next = timerqueue_getnext(&base->active); 1939 + 1940 + return next ? container_of(next, struct hrtimer, node) : NULL; 1941 + } 1942 + 1936 1943 static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now, 1937 1944 unsigned long flags, unsigned int active_mask) 1938 1945 { ··· 1947 1940 struct hrtimer_clock_base *base; 1948 1941 1949 1942 for_each_active_base(base, cpu_base, active) { 1950 - struct timerqueue_node *node; 1951 - ktime_t basenow; 1943 + ktime_t basenow = ktime_add(now, base->offset); 1944 + struct hrtimer *timer; 1952 1945 1953 - basenow = ktime_add(now, base->offset); 1954 - 1955 - while ((node = timerqueue_getnext(&base->active))) { 1956 - struct hrtimer *timer; 1957 - 1958 - timer = container_of(node, struct hrtimer, node); 1959 - 1946 + while ((timer = clock_base_next_timer(base))) { 1960 1947 /* 1961 1948 * The immediate goal for using the softexpires is 1962 1949 * minimizing wakeups, not running timers at the