From: Steven Rostedt Date: Wed, 9 Jul 2008 04:15:32 +0000 (-0400) Subject: sched_clock: record TSC after gtod X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a83bc47c33ab182f1e48977fd5a04024d713c75e;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git sched_clock: record TSC after gtod To read the gtod we need to grab the xtime lock for read. Reading the gtod before the TSC can cause a bigger gab if the xtime lock is contended. This patch simply reverses the order to read the TSC after the gtod. The locking in the reading of the gtod handles any barriers one might think is needed. Signed-off-by: Steven Rostedt Cc: Steven Rostedt Cc: Peter Zijlstra Cc: Andrew Morton Cc: john stultz Signed-off-by: Ingo Molnar --- diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c index ee7cce5029c..28ff6bf5e02 100644 --- a/kernel/sched_clock.c +++ b/kernel/sched_clock.c @@ -237,8 +237,8 @@ void sched_clock_tick(void) WARN_ON_ONCE(!irqs_disabled()); - now = sched_clock(); now_gtod = ktime_to_ns(ktime_get()); + now = sched_clock(); __raw_spin_lock(&scd->lock); __update_sched_clock(scd, now, NULL);