mirror of https://gitee.com/openkylin/linux.git
sparc64: optimize functions that access tick
Replace read tick function pointers with the new hot-patched get_tick(). This optimizes the performance of functions such as: sched_clock() Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Reviewed-by: Steven Sistare <steven.sistare@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4929c83a6c
commit
eae3fc9871
|
@ -752,12 +752,10 @@ static unsigned long tb_ticks_per_usec __read_mostly;
|
||||||
|
|
||||||
void __delay(unsigned long loops)
|
void __delay(unsigned long loops)
|
||||||
{
|
{
|
||||||
unsigned long bclock, now;
|
unsigned long bclock = get_tick();
|
||||||
|
|
||||||
bclock = tick_operations.get_tick();
|
while ((get_tick() - bclock) < loops)
|
||||||
do {
|
;
|
||||||
now = tick_operations.get_tick();
|
|
||||||
} while ((now-bclock) < loops);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__delay);
|
EXPORT_SYMBOL(__delay);
|
||||||
|
|
||||||
|
@ -769,7 +767,7 @@ EXPORT_SYMBOL(udelay);
|
||||||
|
|
||||||
static u64 clocksource_tick_read(struct clocksource *cs)
|
static u64 clocksource_tick_read(struct clocksource *cs)
|
||||||
{
|
{
|
||||||
return tick_operations.get_tick();
|
return get_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init get_tick_patch(void)
|
static void __init get_tick_patch(void)
|
||||||
|
@ -853,13 +851,19 @@ unsigned long long sched_clock(void)
|
||||||
{
|
{
|
||||||
unsigned long quotient = tick_operations.ticks_per_nsec_quotient;
|
unsigned long quotient = tick_operations.ticks_per_nsec_quotient;
|
||||||
unsigned long offset = tick_operations.offset;
|
unsigned long offset = tick_operations.offset;
|
||||||
unsigned long ticks = tick_operations.get_tick();
|
|
||||||
|
|
||||||
return ((ticks * quotient) >> SPARC64_NSEC_PER_CYC_SHIFT) - offset;
|
/* Use barrier so the compiler emits the loads first and overlaps load
|
||||||
|
* latency with reading tick, because reading %tick/%stick is a
|
||||||
|
* post-sync instruction that will flush and restart subsequent
|
||||||
|
* instructions after it commits.
|
||||||
|
*/
|
||||||
|
barrier();
|
||||||
|
|
||||||
|
return ((get_tick() * quotient) >> SPARC64_NSEC_PER_CYC_SHIFT) - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_current_timer(unsigned long *timer_val)
|
int read_current_timer(unsigned long *timer_val)
|
||||||
{
|
{
|
||||||
*timer_val = tick_operations.get_tick();
|
*timer_val = get_tick();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue