All of lore.kernel.org
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Keith Owens <kaos@ocs.com.au>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: How should we do a 64-bit jiffies?
Date: Tue, 23 Oct 2001 01:03:32 -0700	[thread overview]
Message-ID: <3BD52454.218387D9@mvista.com> (raw)
In-Reply-To: <1164.1003813848@ocs3.intra.ocs.com.au>

Keith Owens wrote:
> 
> 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.

As it turns out I already have a spinlock on the update jiffies code. 
The reason one would want to use a 64-bit integer is that the compiler
does a MUCH better job of the ++, i.e. it just does an add carry.  No
if, no jmp.  I suppose I need to lock the read also, but it is not done
often and will hardly ever block.

I am beginning to think that defining a u64 and casting, i.e.:

#define jiffies (unsigned long volitial)jiffies_u64

is the way to go.

George

  parent reply	other threads:[~2001-10-23  8:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-22 15:12 How should we do a 64-bit jiffies? george anzinger
2001-10-23  5:10 ` Keith Owens
2001-10-23  6:05   ` Brian Gerst
2001-10-23  6:23     ` Keith Owens
2001-10-23  8:03   ` george anzinger [this message]
2001-10-23 15:45     ` Linus Torvalds
2001-10-26 20:59       ` 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-11  0:42               ` 64-bit jiffies, a better solution take 2 george anzinger
2002-05-11  8:29                 ` Russell King
2002-05-11 15:01                   ` george anzinger
2002-05-11 16:10                     ` Russell King
2002-05-11 17:31                       ` george anzinger
2002-05-11 17:37                         ` Linus Torvalds
2002-05-11 18:11                           ` Russell King
2002-05-11 23:38                             ` Keith Owens
2002-05-12  0:01                               ` Russell King
2002-05-12  0:31                                 ` Keith Owens
2002-05-12  8:12                                   ` george anzinger
     [not found]                             ` <3CDD6DA1.7B259EF1@mvista.com>
     [not found]                               ` <20020511201748.G1574@flint.arm.linux.org.uk>
2002-05-12  8:03                                 ` 64-bit jiffies, a better solution take 2 (Fix ARM) george anzinger
2002-05-11 16:41                     ` 64-bit jiffies, a better solution take 2 Daniel Jacobowitz
2002-05-13 11:09             ` 64-bit jiffies, a better solution Maciej W. Rozycki

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=3BD52454.218387D9@mvista.com \
    --to=george@mvista.com \
    --cc=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.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 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.