[lkml]   [2009]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH] U300 sched_clock implementation
    This patch was submitted to the ARM Linux maillist, but we need
    some scheduler person to have a look at this sched_clock() thing.

    The U300 timekeeping code is in the -next tree at:

    The OMAP2 solution is in:

    When I look at it I get the feeling, that if this works at all times, then
    anything that has a continous clock source should actually
    implement it this way if they have nothing else so schedule with.
    I wonder how hard that would be to do in a generic way.

    This overrides the global sched_clock() symbol in the Linux
    scheduler with a local implementation which takes advantage of
    the timesource in U300 giving a scheduling resolution of 1us. The
    solution is the same as found in the OMAP2 core code.

    Signed-off-by: Linus Walleij <>
     arch/arm/mach-u300/timer.c |   16 ++++++++++++++++
     1 files changed, 16 insertions(+), 0 deletions(-)

    diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
    index 4bf82f8..222de18 100644
    --- a/arch/arm/mach-u300/timer.c
    +++ b/arch/arm/mach-u300/timer.c
    @@ -346,6 +346,22 @@ static struct clocksource clocksource_u300_1mhz = {
           .flags          = CLOCK_SOURCE_IS_CONTINUOUS,

    + * Override the global weak sched_clock symbol with this
    + * local implementation which uses the clocksource to get some
    + * better resolution when scheduling the kernel. We accept that
    + * this wraps around for now, since it is just a relative time
    + * stamp. (Inspired by OMAP implementation.)
    + */
    +unsigned long long sched_clock(void)
    +       unsigned long long ret;
    +       ret = (unsigned long long) u300_get_cycles();
    +       ret = (ret * clocksource_u300_1mhz.mult_orig) >>
    +               clocksource_u300_1mhz.shift;
    +       return ret;

     * This sets up the system timers, clock source and clock event.
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2009-05-23 23:49    [W:0.030 / U:25.188 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site