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: Optimize for_each_active_base()

Give the compiler some help to emit way better code.

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

authored by

Thomas Gleixner and committed by
Peter Zijlstra
3601a1d8 a64ad57e

+4 -16
+4 -16
kernel/time/hrtimer.c
··· 529 529 trace_hrtimer_start(timer, mode, was_armed); 530 530 } 531 531 532 - static struct hrtimer_clock_base * 533 - __next_base(struct hrtimer_cpu_base *cpu_base, unsigned int *active) 534 - { 535 - unsigned int idx; 536 - 537 - if (!*active) 538 - return NULL; 539 - 540 - idx = __ffs(*active); 541 - *active &= ~(1U << idx); 542 - 543 - return &cpu_base->clock_base[idx]; 544 - } 545 - 546 - #define for_each_active_base(base, cpu_base, active) \ 547 - while ((base = __next_base((cpu_base), &(active)))) 532 + #define for_each_active_base(base, cpu_base, active) \ 533 + for (unsigned int idx = ffs(active); idx--; idx = ffs((active))) \ 534 + for (bool done = false; !done; active &= ~(1U << idx)) \ 535 + for (base = &cpu_base->clock_base[idx]; !done; done = true) 548 536 549 537 #if defined(CONFIG_NO_HZ_COMMON) 550 538 /*