public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Linus Walleij <linus.ml.walleij@gmail.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
	linux-arm-kernel@lists.arm.linux.org.uk
Subject: Re: [PATCH] U300 sched_clock implementation
Date: Mon, 25 May 2009 15:01:50 +0200	[thread overview]
Message-ID: <1243256510.26820.679.camel@twins> (raw)
In-Reply-To: <63386a3d0905250513q6ca56eeepcf7bebe46c447fb4@mail.gmail.com>

On Mon, 2009-05-25 at 14:13 +0200, Linus Walleij wrote:
> 2009/5/24 Peter Zijlstra <peterz@infradead.org>:
> 
> > On Sat, 2009-05-23 at 23:46 +0200, Linus Walleij wrote:
> >
> >> 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.
> >
> > We assume sched_clock() to return time in ns (e-9) resolution.
> 
> Yep okay and in this case:
> 
> >> +       ret = (unsigned long long) u300_get_cycles();
> >> +       ret = (ret * clocksource_u300_1mhz.mult_orig) >>
> >> +               clocksource_u300_1mhz.shift;
> >> +       return ret;
> 
> (mult_orig >> shift) == 1000

Ah, ok -- missed that little detail ;-)

> So for each cycle in cyclecount register we return 1000 * cycles
> i.e 1000ns.
> 
> If it looks nicer we can of course simply:
> return (unsigned long long) u300_get_cycles * 1000;
> 
> But the question here is whether this resolution is enough for
> sched_clock() or if it is irrelevant to override sched_clock()
> if it cannot schedule with better precision than 1000 ns.

No anything better than jiffies is good, 1us certainly is worth the
trouble.

  reply	other threads:[~2009-05-25 13:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <63386a3d0905112337p2d426481o5f9bf9b9489cc57e@mail.gmail.com>
2009-05-23 21:46 ` [PATCH] U300 sched_clock implementation Linus Walleij
2009-05-24  7:57   ` Peter Zijlstra
2009-05-25 12:13     ` Linus Walleij
2009-05-25 13:01       ` Peter Zijlstra [this message]
2009-05-25 13:20         ` Peter Zijlstra
2009-06-01  7:46         ` Linus Walleij
2009-06-02  9:00           ` Peter Zijlstra
2009-07-07  7:42             ` Russell King - ARM Linux
2009-07-07  8:01               ` Linus Walleij
2009-07-08  9:35                 ` Paul Mundt
2009-08-13 11:49 Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243256510.26820.679.camel@twins \
    --to=peterz@infradead.org \
    --cc=linus.ml.walleij@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox