Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3b13c23 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds
Browse files

softlockup: use cpu_clock() instead of sched_clock()



sched_clock() is not a reliable time-source, use cpu_clock() instead.

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3806204c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -40,14 +40,16 @@ static struct notifier_block panic_block = {
 * resolution, and we don't need to waste time with a big divide when
 * 2^30ns == 1.074s.
 */
static unsigned long get_timestamp(void)
static unsigned long get_timestamp(int this_cpu)
{
	return sched_clock() >> 30;  /* 2^30 ~= 10^9 */
	return cpu_clock(this_cpu) >> 30;  /* 2^30 ~= 10^9 */
}

void touch_softlockup_watchdog(void)
{
	__raw_get_cpu_var(touch_timestamp) = get_timestamp();
	int this_cpu = raw_smp_processor_id();

	__raw_get_cpu_var(touch_timestamp) = get_timestamp(this_cpu);
}
EXPORT_SYMBOL(touch_softlockup_watchdog);

@@ -91,7 +93,7 @@ void softlockup_tick(void)
		return;
	}

	now = get_timestamp();
	now = get_timestamp(this_cpu);

	/* Wake up the high-prio watchdog task every second: */
	if (now > (touch_timestamp + 1))