Commit 0df1c986 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Thomas Gleixner
Browse files

timekeeping/vsyscall: Use __iter_div_u64_rem()



On 32-bit x86 when building with clang-9, the 'division' loop gets turned
back into an inefficient division that causes a link error:

kernel/time/vsyscall.o: In function `update_vsyscall':
vsyscall.c:(.text+0xe3): undefined reference to `__udivdi3'

Use the existing __iter_div_u64_rem() function which is used to address the
same issue in other places.

Fixes: 44f57d78 ("timekeeping: Provide a generic update_vsyscall() implementation")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Link: https://lkml.kernel.org/r/20190710130206.1670830-1-arnd@arndb.de
parent 9bdd7bb3
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -104,11 +104,7 @@ void update_vsyscall(struct timekeeper *tk)
	vdso_ts->sec	= tk->xtime_sec + tk->wall_to_monotonic.tv_sec;
	nsec		= tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
	nsec		= nsec + tk->wall_to_monotonic.tv_nsec;
	while (nsec >= NSEC_PER_SEC) {
		nsec = nsec - NSEC_PER_SEC;
		vdso_ts->sec++;
	}
	vdso_ts->nsec	= nsec;
	vdso_ts->sec	+= __iter_div_u64_rem(nsec, NSEC_PER_SEC, &vdso_ts->nsec);

	if (__arch_use_vsyscall(vdata))
		update_vdso_data(vdata, tk);