Bug 75107 - boot time in /proc/stat is incorrect
boot time in /proc/stat is incorrect
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
8.0
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-04 12:05 EDT by Lev Makhlis
Modified: 2007-04-18 12:47 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-10-17 05:22:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lev Makhlis 2002-10-04 12:05:22 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.0.0-10; Linux)

Description of problem:
The "btime" line in /proc/stat shows a number that does not match the actuall boot time. Moreover, this number constantly changes.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. uptime
2. grep btime /proc/stat
3. sleep 10
4. grep btime /proc/stat
 

Actual Results:   11:51am  up 1 day, 11:33, 11 users,  load average: 0.05, 0.05, 0.00
btime 1033721675
btime 1033721683


Expected Results:   11:51am  up 1 day, 11:33, 11 users,  load average: 0.05, 0.05, 0.00
btime 1033618662
btime 1033618662


Additional info:

"btime" is calculated at line 387 in fs/proc/proc_misc.c as
 xtime.tv_sec - jif / HZ
However, jif is initialized at line 317 as
 unsigned long jif = hz_to_std(jiffies);
Changing line 387 to "xtime.tv_sec - jif / 100" will solve the problem.
Comment 1 Lev Makhlis 2002-10-04 15:00:34 EDT
Another problem is that jif is initialized from jiffies, not jiffies_64, 
and with HZ=512, will wrap after about three months.
Comment 2 Kathy Gerber 2002-10-09 21:48:28 EDT
On RedHat 8.0 with stock kernel 2.4.18-14 we are seeing backstepping in /proc/stat as discussed on 
the linux kernel list in April regarding Kernel: 2.4.18-pre6.  

(See 
http://www.uwsg.iu.edu/hypermail/linux/kernel/0204.2/1188.html)

When we run this on 
RedHat 8.0 with kernel 2.4.18-14:

while true; do cat /proc/stat; done | grep -F 'cpu ' 
>/tmp/log

we get results like:

cpu  382258 291357 160205 18511748
cpu  382258 291357 
160205 18511748
cpu  382258 291357 160205 18511748
cpu  382258 291357 160206 18511748
cpu  
382258 291357 160206 18511748  <<<
cpu  382258 291357 160206 18511749  <<<
cpu  382259 291357 
160206 18511748  <<<
cpu  382259 291357 160207 18511747  <<<
cpu  382259 291357 160207 18511748  
<<<
cpu  382259 291357 160207 18511748
cpu  382259 291357 160207 18511749
cpu  382260 291357 
160207 18511748
cpu  382260 291357 160208 18511748

This problem does not occur on RedHat 
7.3 with kernel 2.4.18-10 or 2.4.18-5.
Comment 3 Arjan van de Ven 2002-10-17 05:22:43 EDT
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2002-206.html

Note You need to log in before you can comment on or make changes to this bug.