Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vdso: Move architecture related data before basetime data

Architecture related vdso data is required in the fast path when reading
CLOCK_MONOTONIC or CLOCK_REALTIME. At the moment, this information is
located at the end of the vdso_time_data structure, which is a suboptimal
cache layout.

Move the architecture specific VDSO data right before the basetime
information, which is always required. This change does not have an impact
on architectures with CONFIG_ARCH_HAS_VDSO_DATA=n. Architectures, which
have it enabled, gain a better cache layout.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250303-vdso-clock-v1-18-c1b5c69a166f@linutronix.de

authored by

Anna-Maria Behnsen and committed by
Thomas Gleixner
97a5a90c ed0c10f3

+4 -4
+4 -4
include/vdso/datapage.h
··· 70 70 71 71 /** 72 72 * struct vdso_time_data - vdso datapage representation 73 + * @arch_data: architecture specific data (optional, defaults 74 + * to an empty struct) 73 75 * @seq: timebase sequence counter 74 76 * @clock_mode: clock mode 75 77 * @cycle_last: timebase at clocksource init ··· 85 83 * @tz_dsttime: type of DST correction 86 84 * @hrtimer_res: hrtimer resolution 87 85 * @__unused: unused 88 - * @arch_data: architecture specific data (optional, defaults 89 - * to an empty struct) 90 86 * 91 87 * vdso_time_data will be accessed by 64 bit and compat code at the same time 92 88 * so we should be careful before modifying this structure. ··· 105 105 * offset must be zero. 106 106 */ 107 107 struct vdso_time_data { 108 + struct arch_vdso_time_data arch_data; 109 + 108 110 u32 seq; 109 111 110 112 s32 clock_mode; ··· 127 125 s32 tz_dsttime; 128 126 u32 hrtimer_res; 129 127 u32 __unused; 130 - 131 - struct arch_vdso_time_data arch_data; 132 128 } ____cacheline_aligned; 133 129 134 130 #define vdso_clock vdso_time_data