Re: proc(5) and definition of loadavg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Elie,

On Tue, Feb 7, 2012 at 8:48 PM, Elie De Brauwer <eliedebrauwer@xxxxxxxxx> wrote:
> Hello all,
>
> I've got a small suggestion related to man 5 proc (
> http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html ).
> If you go to /proc/loadavg it states
>
> <quote>
>  The fourth field consists of two numbers separated by a slash (/).
> The first of these is the number of currently executing kernel
> scheduling entities (processes, threads); this will be less than or
> equal to the number of CPUs.  The value after the slash is the number
> of kernel scheduling entities that currently exist on the system.
> </quote>
>
> When I take a look at /proc/loadavg this seems to make sense:
>
> edb@lapedb:~$ cat /proc/loadavg
> 0.04 0.65 0.59 1/284 8102
>
> However, suppose I run 4 background jobs of 'yes bla > /dev/null &'
>
> edb@lapedb:~$ yes bla > /dev/null &
> [1] 8111
> edb@lapedb:~$ yes bla > /dev/null &
> [2] 8112
> edb@lapedb:~$ yes bla > /dev/null &
> [3] 8113
> edb@lapedb:~$ yes bla > /dev/null &
> [4] 8114
> edb@lapedb:~$ cat /proc/loadavg
> 0.18 0.59 0.57 5/289 8115
> edb@lapedb:~$ cat /proc/cpuinfo | grep processor
> processor       : 0
> processor       : 1
>
> Then I see that the 'fourth field' before the slash is five, whereas
> the number of cpu's (dual core laptop) is only two. Hence the 'this
> will be less than or equal to the number of CPUs' in the manpage is
> not correct. Now if we take a deeper look at how this /proc/loadavg
> gets created (in fs/proc/loadavg.c):
> http://lxr.linux.no/#linux+v3.0.4/fs/proc/loadavg.c#L23
>
> We can see that the fourth value before the fraction is the result of
> 'nr_running()' which is turn lives in kern/sched.c (ref:
> http://lxr.linux.no/#linux+v3.0.4/kernel/sched.c#L3197 ) and this
> function just counts the number of runnable threads for each of the
> online cpu's. I have attached a path which rephrases this, the patch
> is rather trivial.

Thanks. I've applied this for man-pages-3.36.

Cheers,

Michael



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux