Skip to content

Commit

Permalink
sched_clock: record TSC after gtod
Browse files Browse the repository at this point in the history
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 <srostedt@redhat.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Jul 11, 2008
1 parent c0c8773 commit a83bc47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a83bc47

Please sign in to comment.