Commit eb6b523c authored by Christophe Leroy's avatar Christophe Leroy Committed by Jialin Zhang
Browse files

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

stable inclusion
from stable-v5.10.141
commit 8c70cce8923187693a608d2b56600ec529915f7b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I685FC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8c70cce8923187693a608d2b56600ec529915f7b



--------------------------------

[ Upstream commit 58efe9f6 ]

In the same spirit as commit c966533f ("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: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/90dcf45ebadfd5a07f24241551c62f619d1cb930.1617209142.git.christophe.leroy@csgroup.eu


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent c5d6b429
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ static inline bool vdso_cycles_ok(u64 cycles)
#endif

#ifdef CONFIG_TIME_NS
static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
static __always_inline int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
					  struct __kernel_timespec *ts)
{
	const struct vdso_data *vd = __arch_get_timens_vdso_data();
@@ -97,7 +97,7 @@ static __always_inline const struct vdso_data *__arch_get_timens_vdso_data(void)
	return NULL;
}

static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
static __always_inline int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
					  struct __kernel_timespec *ts)
{
	return -EINVAL;
@@ -159,7 +159,7 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk,
}

#ifdef CONFIG_TIME_NS
static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk,
static __always_inline int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk,
					    struct __kernel_timespec *ts)
{
	const struct vdso_data *vd = __arch_get_timens_vdso_data();
@@ -188,7 +188,7 @@ static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk,
	return 0;
}
#else
static int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk,
static __always_inline int do_coarse_timens(const struct vdso_data *vdns, clockid_t clk,
					    struct __kernel_timespec *ts)
{
	return -1;