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.

x86: Inline TSC reads in timekeeping

Avoid the overhead of the indirect call for a single instruction to read
the TSC.

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

authored by

Thomas Gleixner and committed by
Peter Zijlstra
b2780118 2e27beeb

+16
+1
arch/x86/Kconfig
··· 141 141 select ARCH_USE_SYM_ANNOTATIONS 142 142 select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH 143 143 select ARCH_WANT_DEFAULT_BPF_JIT if X86_64 144 + select ARCH_WANTS_CLOCKSOURCE_READ_INLINE if X86_64 144 145 select ARCH_WANTS_DYNAMIC_TASK_STRUCT 145 146 select ARCH_WANTS_NO_INSTR 146 147 select ARCH_WANT_GENERAL_HUGETLB
+14
arch/x86/include/asm/clock_inlined.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _ASM_X86_CLOCK_INLINED_H 3 + #define _ASM_X86_CLOCK_INLINED_H 4 + 5 + #include <asm/tsc.h> 6 + 7 + struct clocksource; 8 + 9 + static __always_inline u64 arch_inlined_clocksource_read(struct clocksource *cs) 10 + { 11 + return (u64)rdtsc_ordered(); 12 + } 13 + 14 + #endif
+1
arch/x86/kernel/tsc.c
··· 1201 1201 .mask = CLOCKSOURCE_MASK(64), 1202 1202 .flags = CLOCK_SOURCE_IS_CONTINUOUS | 1203 1203 CLOCK_SOURCE_VALID_FOR_HRES | 1204 + CLOCK_SOURCE_CAN_INLINE_READ | 1204 1205 CLOCK_SOURCE_MUST_VERIFY | 1205 1206 CLOCK_SOURCE_VERIFY_PERCPU, 1206 1207 .id = CSID_X86_TSC,