public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: root@chaos.analogic.com
Cc: vda <vda@port.imtp.ilyichevsk.odessa.ua>,
	Tim Schmielau <tim@physik3.uni-rostock.de>,
	Andreas Dilger <adilger@turbolabs.com>,
	linux-kernel@vger.kernel.org, J Sloan <jjs@lexus.com>
Subject: Re: [Patch] Re: Nasty suprise with uptime
Date: Thu, 01 Nov 2001 09:29:24 -0800	[thread overview]
Message-ID: <3BE18674.789AA1FB@mvista.com> (raw)
In-Reply-To: <Pine.LNX.3.95.1011101102602.30559A-101000@chaos.analogic.com>

"Richard B. Johnson" wrote:
> 
> On Thu, 1 Nov 2001, vda wrote:
> 
> > On Thursday 01 November 2001 00:52, Tim Schmielau wrote:
> >
> > > OK, absolutely last patch for today. Sorry to bother everyone, but the
> > > jiffies wraparound logic was broken in the previous patch.
> > >
> > > As stated before, I would kindly ask for widespread testing PROVIDED IT IS
> > > OK FOR YOU TO RISK THE STABILITY OF YOUR BOX!
> >
> > I see you dropped jiffies_hi update in timer int.
> > IMHO argument on wasting 6 CPU cycles or so per each timer int:
> >
> > -     jiffies++;
> > +     if(++jiffies==0) jiffies_hi++;
> >
> > is not justified. I'd rather see simple and correct code in timer int
> > rather than jumping thru the hoops in get_jiffies_64().
> >
> > For CPU cycle saving zealots: I advocate saving 2 static longs in get_jiffies
> > instead :-)
> > --
> > vda
> > -
> 
> Well not exactly zealots. I test a lot of stuff. In fact, the code
> you propose:
> 
>         if(++jiffies==0) jiffies_hi++;
> 
> ... actually works quite well:
> 
I think that bumping a u64 is actually faster.  We have to remember that
this code is executed every 10 ms.  It is not in a loop.  This means
that the chance of branch prediction being available is nil.  In this
case the processor will predict the branch as not taken and be wrong
(except for once every 1.3 years). 

On the other hand, the u64 bump has no branches, just an add carry. 
This amounts to 1 add carry each bump (assuming we can get cc to do the
add carry to memory) and no branches to predict.  We should also take
care to put the u64 in one cache line, of course.

George



> Script started on Thu Nov  1 10:23:54 2001
> # ./chk
> Simple bump = 13
> Bump chk and incr = 15
> # ./chk
> Simple bump = 13
> Bump chk and incr = 15
> # ./chk
> Simple bump = 13
> Bump chk and incr = 15
> # exit
> exit
> Script done on Thu Nov  1 10:24:08 2001
> 
> It adds only two CPU clock cycles if (iff) the 'C' compiler is
> well behaved.
> 
> Test code is appended. In the test code, I calculate everything, then
> print the results. This is so the 'C' library + system call doesn't
> mess up the cache. Note this if you use this as a template to test
> other questionable code snippets.
> 
> Cheers,
> Dick Johnson
> 
> Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
> 
>     I was going to compile a list of innovations that could be
>     attributed to Microsoft. Once I realized that Ctrl-Alt-Del
>     was handled in the BIOS, I found that there aren't any.
> 
>   ------------------------------------------------------------------------
>                        Name: test_jiff.tar.gz
>    test_jiff.tar.gz    Type: Unix Tape Archive (application/x-tar)
>                    Encoding: BASE64

  parent reply	other threads:[~2001-11-01 19:28 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-31 22:11 [Patch] Re: Nasty suprise with uptime Petr Vandrovec
2001-10-31 21:45 ` Andreas Dilger
2001-10-31 22:58 ` Tim Schmielau
2001-10-31 23:56   ` Andreas Dilger
2001-11-01  0:23     ` Tim Schmielau
2001-11-01  0:52       ` Tim Schmielau
2001-11-01 11:21         ` george anzinger
2001-11-01 11:40           ` Tim Schmielau
2001-11-02  0:28             ` Tim Schmielau
2001-11-02  1:23               ` Andreas Dilger
2001-11-02  9:10                 ` Miquel van Smoorenburg
2001-11-02 17:18                 ` Tim Schmielau
2001-11-02 18:48                   ` Andreas Dilger
2001-11-02 21:35                     ` possibly incorrect comparisons of jiffies in linux kernel Tim Schmielau
2001-11-01 16:35         ` [Patch] Re: Nasty suprise with uptime vda
2001-11-01 15:34           ` Richard B. Johnson
2001-11-01 17:02             ` Benjamin LaHaise
2001-11-01 18:03               ` Richard B. Johnson
2001-11-01 18:34                 ` Benjamin LaHaise
2001-11-02 14:46                   ` vda
2001-11-01 17:29             ` george anzinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-11-01  9:02 Petr Vandrovec
     [not found] <01103121070200.01262@nemo>
2001-10-31 19:26 ` Tim Schmielau
2001-10-31 19:52   ` Richard B. Johnson
2001-10-31 20:00     ` J Sloan
2001-10-31 20:20     ` Charles Cazabon
2001-10-31 20:33       ` Kurt Roeckx
2001-10-31 20:47 ` Tim Schmielau
2001-10-31 21:07   ` Andreas Dilger
2001-10-31 21:11   ` Richard B. Johnson
2001-11-01 16:09   ` vda
2001-10-31 11:35 Tim Schmielau
2001-10-31 15:39 ` vda
2001-10-31 14:31   ` Richard B. Johnson
2001-10-31 18:16     ` Tim Schmielau
2001-10-31 18:35       ` Tim Schmielau
2001-10-31 18:59         ` Andreas Dilger
2001-10-31 18:40       ` Andreas Dilger
2001-10-31 18:58         ` Gerhard Mack
2001-10-31 19:14           ` Richard B. Johnson
2001-10-31 20:11             ` Gerhard Mack
2001-10-31 20:39               ` Richard B. Johnson
2001-10-31 20:52               ` Andreas Dilger
2001-10-31 21:05                 ` Tim Schmielau
2001-10-31 21:39                   ` Andreas Dilger
2001-10-31 21:17                 ` Richard B. Johnson
2001-11-01  7:45                   ` Ville Herva
2001-10-31 19:06       ` george anzinger
2001-10-31 22:54       ` george anzinger
2001-11-04 18:31         ` Ton Hospel

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=3BE18674.789AA1FB@mvista.com \
    --to=george@mvista.com \
    --cc=adilger@turbolabs.com \
    --cc=jjs@lexus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=tim@physik3.uni-rostock.de \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /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