lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 28 Nov 2008 15:40:39 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Ron <ron@...ian.org>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	linux-kernel@...r.kernel.org
Subject: Re: [patch] fix for sched_clock() when using jiffies

* Ron <ron@...ian.org> wrote:

> On Wed, Nov 26, 2008 at 04:16:38PM +0100, Peter Zijlstra wrote:
> > 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..1ce2e53 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;
> 
> 
>  Signed-off-by: Ron Lee <ron@...ian.org>

whitespace damage: all tabs are space.

please see Documentation/email-clients.txt for how to send patches.

Also, when you resend a patch, do it without quotes and by including the 
fill commit log again - to make it easier to apply it. (and not forcing 
me to cut&paste various emails - it's fundamentall error-prone)

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ