mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: lib/vdso: Only read hrtimer_res when needed in __cvdso_clock_getres()
Only perform READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res) for
HRES and RAW clocks.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/7ac2f0d21652f95e2bbdfa6bd514ae6c7caf53ab.1579196675.git.christophe.leroy@c-s.fr
(cherry picked from commit 49a101d716)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 154668398
Change-Id: I0441a793d4703755e8026f23c07e5c1f12544319
This commit is contained in:
committed by
Alistair Delva
parent
da76170fa2
commit
63bc2c97b7
@@ -186,7 +186,6 @@ static __maybe_unused
|
||||
int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res)
|
||||
{
|
||||
const struct vdso_data *vd = __arch_get_vdso_data();
|
||||
u64 hrtimer_res;
|
||||
u32 msk;
|
||||
u64 ns;
|
||||
|
||||
@@ -194,7 +193,6 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res)
|
||||
if (unlikely((u32) clock >= MAX_CLOCKS))
|
||||
return -1;
|
||||
|
||||
hrtimer_res = READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res);
|
||||
/*
|
||||
* Convert the clockid to a bitmask and use it to check which
|
||||
* clocks are handled in the VDSO directly.
|
||||
@@ -204,7 +202,7 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res)
|
||||
/*
|
||||
* Preserves the behaviour of posix_get_hrtimer_res().
|
||||
*/
|
||||
ns = hrtimer_res;
|
||||
ns = READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res);
|
||||
} else if (msk & VDSO_COARSE) {
|
||||
/*
|
||||
* Preserves the behaviour of posix_get_coarse_res().
|
||||
|
||||
Reference in New Issue
Block a user