mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Albert D. Cahalan" <acahalan@cs.uml.edu>
To: tomh@po.crl.go.jp (Tom Holroyd)
Cc: acahalan@cs.uml.edu (Albert D. Cahalan),
	linux-kernel@vger.kernel.org (kernel mailing list)
Subject: Re: Unknown HZ value! (2000) Assume 1024.
Date: Thu, 3 May 2001 02:15:20 -0400 (EDT)	[thread overview]
Message-ID: <200105030615.f436FKN11735@saturn.cs.uml.edu> (raw)
In-Reply-To: <Pine.LNX.4.30.0105021600420.27862-100000@holly.crl.go.jp> from "Tom Holroyd" at May 02, 2001 04:47:21 PM

Tom Holroyd writes:
> On Wed, 2 May 2001, Albert D. Cahalan wrote:

>> For 32-bit systems, we use 32-bit values to reduce overhead.
>> This causes problems at 495/smp_num_cpus days of uptime.
>
> You mean for HZ == 100.

Well, OK. No unmodified 32-bit system runs HZ == 1024.

> And I guess the overhead in question is the cost
> of a 64 bit add vs. a 32 bit add HZ times per second?  On a 64 bit
> machine, that overhead is likely to be exactly zero.  It is zero on my
> machine.  For integer math on an Alpha, changing the ints to longs can
> even make a program run faster.

Yes.

>> Proposed hack: set a very-long-duration timer (several days)
>> to check for the high bit changing. Count bit flips.
>
> What about the interval between when it flips and when you notice it?

Not a problem. Note that I count bit flips, not roll overs.
Here are the two variables, with "flips" lagging a bit:

flips  jiffies
0      0x7fffff26
0      0x80000003   (not noticed yet)
1      0x8000b01a
1      0xffffffe7
1      0x00000666   (not noticed yet)
2      0x0000ee15

Calculate 64-bit (well, 63-bit) jiffies as:

long long total;
unsigned f = flips;
unsigned j = jiffies;
f += (f ^ (j>>31)) & 1;
total = ((long long)f<<31) | j;

Now print the total.

Well, there it is. Like it? The /proc reader does 64-bit operations
and a timer goes off every few days, saving the clock tick from
doing any 64-bit operations. The fast path stays fast, while procps
can get useful data even after years of uptime.



  reply	other threads:[~2001-05-03 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-02  5:13 Tom Holroyd
2001-05-02  6:42 ` Albert D. Cahalan
2001-05-02  7:47   ` Tom Holroyd
2001-05-03  6:15     ` Albert D. Cahalan [this message]
2001-05-02  9:49   ` Ingo Oeser

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=200105030615.f436FKN11735@saturn.cs.uml.edu \
    --to=acahalan@cs.uml.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomh@po.crl.go.jp \
    /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

all inboxes | Powered by JetHome®