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

lib/vdso: Mark do_hres_timens() and do_coarse_timens() __always_inline()

In the same spirit as commit c966533f8c6c ("lib/vdso: Mark do_hres()
and do_coarse() as __always_inline"), mark do_hres_timens() and
do_coarse_timens() __always_inline.

The measurement below in on a non timens process, ie on the fastest path.

On powerpc32, without the patch:

clock-gettime-monotonic-raw: vdso: 1155 nsec/call
clock-gettime-monotonic-coarse: vdso: 813 nsec/call
clock-gettime-monotonic: vdso: 1076 nsec/call

With the patch:

clock-gettime-monotonic-raw: vdso: 1100 nsec/call
clock-gettime-monotonic-coarse: vdso: 667 nsec/call
clock-gettime-monotonic: vdso: 1025 nsec/call

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/90dcf45ebadfd5a07f24241551c62f619d1cb930.1617209142.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
58efe9f6 8f6cc75a

+8 -8
+8 -8
lib/vdso/gettimeofday.c
··· 46 46 #endif 47 47 48 48 #ifdef CONFIG_TIME_NS 49 - static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, 50 - struct __kernel_timespec *ts) 49 + static __always_inline int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, 50 + struct __kernel_timespec *ts) 51 51 { 52 52 const struct vdso_data *vd = __arch_get_timens_vdso_data(); 53 53 const struct timens_offset *offs = &vdns->offset[clk]; ··· 97 97 return NULL; 98 98 } 99 99 100 - static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, 101 - struct __kernel_timespec *ts) 100 + static __always_inline int do_hres_timens(const struct vdso_data *vdns, clockid_t clk, 101 + struct __kernel_timespec *ts) 102 102 { 103 103 return -EINVAL; 104 104 } ··· 159 159 } 160 160 161 161 #ifdef CONFIG_TIME_NS 162 - static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, 163 - struct __kernel_timespec *ts) 162 + static __always_inline int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, 163 + struct __kernel_timespec *ts) 164 164 { 165 165 const struct vdso_data *vd = __arch_get_timens_vdso_data(); 166 166 const struct vdso_timestamp *vdso_ts = &vd->basetime[clk]; ··· 188 188 return 0; 189 189 } 190 190 #else 191 - static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, 192 - struct __kernel_timespec *ts) 191 + static __always_inline int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk, 192 + struct __kernel_timespec *ts) 193 193 { 194 194 return -1; 195 195 }