public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ron <ron@debian.org>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: [patch] fix for sched_clock() when using jiffies
Date: Wed, 26 Nov 2008 16:16:38 +0100	[thread overview]
Message-ID: <1227712598.4454.199.camel@twins> (raw)
In-Reply-To: <20081126150645.GA28153@homer.shelbyville.oz>

On Thu, 2008-11-27 at 01:36 +1030, Ron wrote:
> Hi,
> 
> I'm in the process of updating a port for an ARM based chip we've been
> working on, from 2.6.22-rc4'ish to the current HEAD of Linus' tree, and
> I started seeing the following:
> 
> [    0.000000] PID hash table entries: 512 (order: 9, 2048 bytes)
> [42949372.970000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
> 
> The reason appears to be that printk_clock() has been replaced with a
> call to cpu_clock, which in our case currently falls back to the default
> (weak) implementation of sched_clock() that uses jiffies -- but doesn't
> account for the initial offset of the jiffy count.  The following simple
> patch fixes it for me, in line with what printk_clock used to do.
> 

Looks good, except I suspect this line will now be longer than 80
characters and you forgot to provide your signed-off-by line.

> 
> diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
> index 8178724..d76814e 100644
> --- a/kernel/sched_clock.c
> +++ b/kernel/sched_clock.c
> @@ -37,7 +37,7 @@
>   */
>  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);
>  }
>  
> 


  reply	other threads:[~2008-11-26 15:17 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 [this message]
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
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=1227712598.4454.199.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ron@debian.org \
    /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