All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ron <ron@debian.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>, linux-kernel@vger.kernel.org
Subject: [PATCH] fix for sched_clock() when using jiffies
Date: Sat, 9 May 2009 05:34:44 +0930	[thread overview]
Message-ID: <20090508200444.GA22132@homer.shelbyville.oz> (raw)
In-Reply-To: <20090508132449.GV5417@homer.shelbyville.oz>

 
Account for the initial offset to the jiffy count.

Signed-off-by: Ron Lee <ron@debian.org>

---
 kernel/sched_clock.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index a0b0852..a1567b1 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -37,7 +37,8 @@
  */
 unsigned long long __attribute__((weak)) sched_clock(void)
 {
-	return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
+	return (unsigned long long)(jiffies - INITIAL_JIFFIES)
+					* (NSEC_PER_SEC / HZ);
 }
 
 static __read_mostly int sched_clock_running;
-- 
1.6.1.3


  reply	other threads:[~2009-05-08 20:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-26 15:06 [patch] fix for sched_clock() when using jiffies Ron
2008-11-26 15:16 ` Peter Zijlstra
2008-11-26 15:31   ` Ron
2008-11-28 14:40     ` Ingo Molnar
2009-05-08 13:24       ` [PATCH] " Ron
2009-05-08 20:04         ` Ron [this message]
2009-05-08 23:01           ` Andrew Morton
2009-05-09  0:40             ` Ron
2009-05-09  1:15               ` Andrew Morton
2009-05-09  4:05                 ` Ron
2009-05-09  7:04                   ` Andrew Morton
2009-05-10 10:45                     ` Ron
2009-05-09 12:41                 ` Paul Mundt

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=20090508200444.GA22132@homer.shelbyville.oz \
    --to=ron@debian.org \
    --cc=a.p.zijlstra@chello.nl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.