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

lib/vdso: Avoid highres update if clocksource is not VDSO capable

If the current clocksource is not VDSO capable there is no point in
updating the high resolution parts of the VDSO data.

Replace the architecture specific check with a check for a VDSO capable
clocksource and skip the update if there is none.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://lkml.kernel.org/r/20200207124403.563379423@linutronix.de


+3 -17
-7
arch/arm/include/asm/vdso/vsyscall.h
··· 22 22 #define __arch_get_k_vdso_data __arm_get_k_vdso_data 23 23 24 24 static __always_inline 25 - bool __arm_update_vdso_data(void) 26 - { 27 - return cntvct_ok; 28 - } 29 - #define __arch_update_vdso_data __arm_update_vdso_data 30 - 31 - static __always_inline 32 25 void __arm_sync_vdso_data(struct vdso_data *vdata) 33 26 { 34 27 flush_dcache_page(virt_to_page(vdata));
-7
include/asm-generic/vdso/vsyscall.h
··· 11 11 } 12 12 #endif /* __arch_get_k_vdso_data */ 13 13 14 - #ifndef __arch_update_vdso_data 15 - static __always_inline bool __arch_update_vdso_data(void) 16 - { 17 - return true; 18 - } 19 - #endif /* __arch_update_vdso_data */ 20 - 21 14 #ifndef __arch_update_vsyscall 22 15 static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata, 23 16 struct timekeeper *tk)
+3 -3
kernel/time/vsyscall.c
··· 105 105 WRITE_ONCE(vdata[CS_HRES_COARSE].hrtimer_res, hrtimer_resolution); 106 106 107 107 /* 108 - * Architectures can opt out of updating the high resolution part 109 - * of the VDSO. 108 + * If the current clocksource is not VDSO capable, then spare the 109 + * update of the high reolution parts. 110 110 */ 111 - if (__arch_update_vdso_data()) 111 + if (clock_mode != VDSO_CLOCKMODE_NONE) 112 112 update_vdso_data(vdata, tk); 113 113 114 114 __arch_update_vsyscall(vdata, tk);