Skip to content

Commit a2ca00e

Browse files
Linus WalleijRussell King
authored andcommitted
ARM: 5704/1: U300 sched_clock implementation v2
This adds the long debated sched_clock() override for the weak in-kernel jiffybased sched_clock(). The implementation is more or less identical to the one used in arch/arm/plat-omap/common.c and at last attempt to merge this the merge was postponed at the request of Peter Zijlstra due to pending discussions regarding generalized clocksource-based sched_clock() implementations by adding a flag to the clocksource. However that discussion ended up with the generic code needing to be rewritten and Paul Mundt see no reason not to proceed with this for the time being as it can be easily converted once the generic code is in place. Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 6be2a0c commit a2ca00e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎arch/arm/mach-u300/timer.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,21 @@ static struct clocksource clocksource_u300_1mhz = {
346346
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
347347
};
348348

349+
/*
350+
* Override the global weak sched_clock symbol with this
351+
* local implementation which uses the clocksource to get some
352+
* better resolution when scheduling the kernel. We accept that
353+
* this wraps around for now, since it is just a relative time
354+
* stamp. (Inspired by OMAP implementation.)
355+
*/
356+
unsigned long long notrace sched_clock(void)
357+
{
358+
return clocksource_cyc2ns(clocksource_u300_1mhz.read(
359+
&clocksource_u300_1mhz),
360+
clocksource_u300_1mhz.mult,
361+
clocksource_u300_1mhz.shift);
362+
}
363+
349364

350365
/*
351366
* This sets up the system timers, clock source and clock event.

0 commit comments

Comments
 (0)