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: Replace the bitfield in hrtimer_cpu_base

Use bool for the various flags as that creates better code in the hot path.

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

authored by

Thomas Gleixner and committed by
Peter Zijlstra
7d27eafe 8ffc9ea8

+18 -17
+5 -5
include/linux/hrtimer_defs.h
··· 83 83 unsigned int cpu; 84 84 unsigned int active_bases; 85 85 unsigned int clock_was_set_seq; 86 - unsigned int hres_active : 1, 87 - in_hrtirq : 1, 88 - hang_detected : 1, 89 - softirq_activated : 1, 90 - online : 1; 86 + bool hres_active; 87 + bool in_hrtirq; 88 + bool hang_detected; 89 + bool softirq_activated; 90 + bool online; 91 91 #ifdef CONFIG_HIGH_RES_TIMERS 92 92 unsigned int nr_events; 93 93 unsigned short nr_retries;
+13 -12
kernel/time/hrtimer.c
··· 741 741 pr_warn("Could not switch to high resolution mode on CPU %u\n", base->cpu); 742 742 return; 743 743 } 744 - base->hres_active = 1; 744 + base->hres_active = true; 745 745 hrtimer_resolution = HIGH_RES_NSEC; 746 746 747 747 tick_setup_sched_timer(true); ··· 1854 1854 now = hrtimer_update_base(cpu_base); 1855 1855 __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_SOFT); 1856 1856 1857 - cpu_base->softirq_activated = 0; 1857 + cpu_base->softirq_activated = false; 1858 1858 hrtimer_update_softirq_timer(cpu_base, true); 1859 1859 1860 1860 raw_spin_unlock_irqrestore(&cpu_base->lock, flags); ··· 1881 1881 raw_spin_lock_irqsave(&cpu_base->lock, flags); 1882 1882 entry_time = now = hrtimer_update_base(cpu_base); 1883 1883 retry: 1884 - cpu_base->in_hrtirq = 1; 1884 + cpu_base->in_hrtirq = true; 1885 1885 /* 1886 1886 * Set expires_next to KTIME_MAX, which prevents that remote CPUs queue 1887 1887 * timers while __hrtimer_run_queues() is expiring the clock bases. ··· 1892 1892 1893 1893 if (!ktime_before(now, cpu_base->softirq_expires_next)) { 1894 1894 cpu_base->softirq_expires_next = KTIME_MAX; 1895 - cpu_base->softirq_activated = 1; 1895 + cpu_base->softirq_activated = true; 1896 1896 raise_timer_softirq(HRTIMER_SOFTIRQ); 1897 1897 } 1898 1898 ··· 1905 1905 * against it. 1906 1906 */ 1907 1907 cpu_base->expires_next = expires_next; 1908 - cpu_base->in_hrtirq = 0; 1908 + cpu_base->in_hrtirq = false; 1909 1909 raw_spin_unlock_irqrestore(&cpu_base->lock, flags); 1910 1910 1911 1911 /* Reprogramming necessary ? */ 1912 1912 if (!tick_program_event(expires_next, 0)) { 1913 - cpu_base->hang_detected = 0; 1913 + cpu_base->hang_detected = false; 1914 1914 return; 1915 1915 } 1916 1916 ··· 1939 1939 * time away. 1940 1940 */ 1941 1941 cpu_base->nr_hangs++; 1942 - cpu_base->hang_detected = 1; 1942 + cpu_base->hang_detected = true; 1943 1943 raw_spin_unlock_irqrestore(&cpu_base->lock, flags); 1944 1944 1945 1945 delta = ktime_sub(now, entry_time); ··· 1987 1987 1988 1988 if (!ktime_before(now, cpu_base->softirq_expires_next)) { 1989 1989 cpu_base->softirq_expires_next = KTIME_MAX; 1990 - cpu_base->softirq_activated = 1; 1990 + cpu_base->softirq_activated = true; 1991 1991 raise_timer_softirq(HRTIMER_SOFTIRQ); 1992 1992 } 1993 1993 ··· 2239 2239 2240 2240 /* Clear out any left over state from a CPU down operation */ 2241 2241 cpu_base->active_bases = 0; 2242 - cpu_base->hres_active = 0; 2243 - cpu_base->hang_detected = 0; 2242 + cpu_base->hres_active = false; 2243 + cpu_base->hang_detected = false; 2244 2244 cpu_base->next_timer = NULL; 2245 2245 cpu_base->softirq_next_timer = NULL; 2246 2246 cpu_base->expires_next = KTIME_MAX; 2247 2247 cpu_base->softirq_expires_next = KTIME_MAX; 2248 - cpu_base->online = 1; 2248 + cpu_base->softirq_activated = false; 2249 + cpu_base->online = true; 2249 2250 return 0; 2250 2251 } 2251 2252 ··· 2304 2303 smp_call_function_single(ncpu, retrigger_next_event, NULL, 0); 2305 2304 2306 2305 raw_spin_unlock(&new_base->lock); 2307 - old_base->online = 0; 2306 + old_base->online = false; 2308 2307 raw_spin_unlock(&old_base->lock); 2309 2308 2310 2309 return 0;