[lkml]   [2001]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectUnknown HZ value! (2000) Assume 1024.
Alpha.  2.4.1.  Hz = 1024.  Uptime > 48.54518 days (low idle).
(Subject message from ps and friends.)

4400586.27 150439.36

cpu 371049158 3972370867 8752820 4448994822
(user, nice, system, idle)

In .../fs/proc/proc_misc.c:kstat_read_proc(), the cpu line is being
computed by:

len = sprintf(page, "cpu %u %u %u %lu\n", user, nice, system,
jif * smp_num_cpus - (user + nice + system));

The user, nice, and system values add up to 4352172845 > 2^32, and jif is
4400586.27 * 1024 = 4506200340, leading to the incorrect idle time (1
cpu). It should be calculated this way:

len = sprintf(page, "cpu %u %u %u %lu\n", user, nice, system,
jif * smp_num_cpus - ((unsigned long)user + nice + system));

or just declare those as unsigned longs instead of ints. I notice also
that since kstat.per_cpu_nice is an int, it's going to overflow in another
3.6 days anyhow. I'll let you know what blows up then. Any chance of
making those guys longs?

The ps program, of course, is trying to calculate HZ by inverting the
above calculation, and it gets a bogus value. I suppose it could use
(uptime[0] - uptime[1]) / (user + nice + system) instead of trying to
calculate jif first, but it'll still fail when the ints roll over.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:52    [W:0.061 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site