public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: 64-bit jiffies, a better solution
@ 2002-05-11  4:19 Jim Houston
  2002-05-11  6:58 ` george anzinger
  0 siblings, 1 reply; 7+ messages in thread
From: Jim Houston @ 2002-05-11  4:19 UTC (permalink / raw)
  To: linux-kernel

Hi!

First what problem are you trying to solve?
Why not have both variables and if they happen
to endup in the same cache line you probably 
need years worth of jiffies to notice how
long one more add takes.  E.g.

	jiffies_64++;
	jiffies++;

To round out the list of options, how about a few lines of 
inline asm?  Maybe something like:

   extern unsigned long long jiffie_64;
   extern unsigned int jiffie;
   __asm__ (" \
        .data
        .align  8
        .global jiffie
        .global jiffie_64
        .type   jiffie,@object
        .size   jiffie,4
        .type   jiffie_64,@object
        .size   jiffie_64,8
   jiffie_64:
   jiffie:
        .long   0, 0
   ");

Adding the obvious ifdef of course.  Aside for broken
binutils this might be portable code :-)

Jim Houston - Concurrent Computer
Corp.

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: How should we do a 64-bit jiffies?
@ 2001-10-23  5:10 Keith Owens
  2001-10-23  8:03 ` george anzinger
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Owens @ 2001-10-23  5:10 UTC (permalink / raw)
  To: george anzinger; +Cc: linux-kernel@vger.kernel.org

On Mon, 22 Oct 2001 08:12:24 -0700, 
george anzinger <george@mvista.com> wrote:
>I am working on POSIX timers where there is defined a CLOCK_MONOTONIC. 
>The most reasonable implementation of this clock is that it is "uptime"
>or jiffies.  The problem is that it is most definitely not MONOTONIC
>when it rolls back to 0 :(  Thus the need for 64-bits.

If you want to leave existing kernel code alone so it still uses 32 bit
jiffies, just maintain a separate high order 32 bit field which is only
used by the code that really needs it.  On 32 bit machines, the jiffie
code does

  old_jiffies = jiffies++;
  if (jiffies < old_jiffies)
  	++high_jiffies;

You will need a spin lock around that on 32 bit systems, but that is
true for anything that tries to do 64 bit counter updates on a 32 bit
system.  None of your suggestions will work on ix86, it does not
support atomic updates on 64 bit fields in hardware.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-05-13 11:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-11  4:19 64-bit jiffies, a better solution Jim Houston
2002-05-11  6:58 ` george anzinger
  -- strict thread matches above, loose matches on Subject: below --
2001-10-23  5:10 How should we do a 64-bit jiffies? Keith Owens
2001-10-23  8:03 ` george anzinger
     [not found]   ` <200110231545.f9NFjgg01377@penguin.transmeta.com>
2002-05-10 21:35     ` 64-bit jiffies, a better solution george anzinger
2002-05-10 21:52       ` Linus Torvalds
2002-05-10 22:36         ` george anzinger
2002-05-10 22:40           ` Linus Torvalds
2002-05-13 11:09           ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox