From: buhr@stat.wisc.edu (Kevin Buhr)
To: Mike Galbraith <mikeg@wen-online.de>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Linux 2.4.2 fails to merge mmap areas, 700% slowdown.
Date: 21 Mar 2001 14:16:06 -0600 [thread overview]
Message-ID: <vba4rwm6fp5.fsf@mozart.stat.wisc.edu> (raw)
In-Reply-To: <Pine.LNX.4.33.0103211738240.1981-100000@mikeg.weiden.de>
In-Reply-To: Mike Galbraith's message of "Wed, 21 Mar 2001 17:45:30 +0100 (CET)"
Mike Galbraith <mikeg@wen-online.de> writes:
>
> Yes. I'm so used to UP numbers I didn't think. I saw user larger than
> real on my UP box yesterday during some testing, and then seeing this
> post... oops.
Okay, so you see "user > real" on a UP box running an SMP kernel.
First, I'm not really familiar with this part of the kernel, but as I
understand things (and others will correct me if I'm wrong) ...
The "real time" is calculated by subtracting the "gettimeofday" before
and after running the process. The "user" and "system" times are
sampled times updated every timer tick.
A discrepancy of a hundredth of a second is perfectly normal.
"gettimeofday" uses a neat trick to get microsecond accuracy, but the
user and system times only have one timer tick (1/HZ=.01sec on i386)
resolution. For this reason, any CPU intensive program can give
slightly (within .01sec or so) higher user than real:
buhr@saurus:~/src/cpuburn/cpuburn-1.2$ time ./burnP6
real 0m6.438s
user 0m6.440s
sys 0m0.000s
^C
buhr@saurus:~/src/cpuburn/cpuburn-1.2$
If your discrepancy is bigger than a couple hundredths of second, it
gets more complicated.
In an SMP kernel, the jiffies are updated by the "do_timer" function,
and the timer bottom half uses the jiffies to update the time of day.
On the other hand, the user and system times are updated by the
"smp_local_timer_interrupt".
On an SMP motherboard (one with an APIC), "do_timer" is invoked by
timer ticks from the dedicated timer chip, but "smp_local_timer_
interrupt" is invoked by a timer on the APIC chip. These two timers
will run at nearly the same speed (HZ times per second), but not
exactly. If the APIC timer is significantly faster, you can have
user+system>real on an SMP motherboard, even though it only has one
processor installed!
So, the first question is, does your "UP" box really have a UP-only
motherboard? That is, in your bootup messages, do you see a line like
this:
Mar 5 15:32:28 mozart kernel: SMP motherboard not detected. Using
dummy APIC emulation.
If you don't see such a line, this might be the problem: the real time
is based on a different timer than the user and system times.
I believe the APIC timer is based on bus frequency. If you're over-
or under-clocking your board, you may see huge discrepancies.
If you *do* see the emulation message, then "do_timer" and
"smp_local_timer_interrupt" are both called exactly once on every
timer tick, so there is no discrepancy possible there.
However, the "gettimeofday" time isn't just based on the jiffies
count. The time adjustment parameters (set by the adjtimex(2) system
call) can modify the "gettimeofday" time away from what would normally
be calculated from jiffies alone. If you are running a time daemon,
like NTP, if you've run "ntpdate" at bootup and a time adjustment is
in progress, or if you've used the "adjtimex" utility directly to make
your system clock more accurate, then that could also account for the
discrepancy.
In any event, if the discrepancy is large: if user, for a
single-threaded process, exceeds the real time by more than 1% (or a
few hundredths of a second, whichever is greater) on any system, I
think this indicates a serious problem.
Kevin <buhr@stat.wisc.edu>
next prev parent reply other threads:[~2001-03-21 20:17 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-20 18:28 Serge Orlov
2001-03-20 18:43 ` Linus Torvalds
2001-03-20 18:59 ` Jakob Østergaard
2001-03-21 1:20 ` Kevin Buhr
2001-03-21 6:41 ` Mike Galbraith
2001-03-21 14:56 ` Matthias Urlichs
2001-03-21 15:05 ` Mike Galbraith
2001-03-21 15:59 ` Kurt Garloff
2001-03-21 16:45 ` Mike Galbraith
2001-03-21 20:16 ` Kevin Buhr [this message]
2001-03-22 9:04 ` Mike Galbraith
2001-03-22 22:19 ` Kevin Buhr
2001-03-23 7:44 ` Mike Galbraith
2001-03-23 21:36 ` 2.4.2-ac20 patch for process time double-counting (was: Linux 2.4.2 fails to merge mmap areas, 700% slowdown.) Kevin Buhr
2001-03-24 7:49 ` Mike Galbraith
2001-03-24 19:27 ` Kevin Buhr
2001-03-21 1:38 ` Linux 2.4.2 fails to merge mmap areas, 700% slowdown David S. Miller
2001-03-21 20:19 ` Kevin Buhr
2001-03-22 18:23 ` Kevin Buhr
2001-03-22 18:35 ` Jakob Østergaard
2001-03-23 4:32 ` Kevin Buhr
2001-03-24 4:11 ` Zack Weinberg
2001-03-24 21:46 ` Kevin Buhr
2001-03-24 5:02 ` Linus Torvalds
2001-03-24 9:31 ` Jakob Østergaard
2001-03-24 9:48 ` Jakob Østergaard
2001-03-24 19:54 ` Kevin Buhr
2001-03-25 3:17 ` Jakob Østergaard
2001-03-25 16:47 ` Jamie Lokier
[not found] ` <200103240502.VAA02673@penguin.transmeta.com>
2001-03-24 21:22 ` Kevin Buhr
2001-03-25 3:37 ` Linus Torvalds
2001-03-26 4:22 ` Kevin Buhr
2001-03-23 20:43 ` James Lewis Nance
2001-03-20 18:43 ` Jakob Østergaard
2001-03-21 2:02 Dieter Nützel
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=vba4rwm6fp5.fsf@mozart.stat.wisc.edu \
--to=buhr@stat.wisc.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=mikeg@wen-online.de \
/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®