kvm_open errors on /proc/*/mem in top

Sergey Kandaurov pluknet at gmail.com
Fri Jun 10 13:43:04 UTC 2011


On 10 June 2011 00:01, Jim Bryant <kc5vdj.freebsd at gmail.com> wrote:
> i'm not sure which list this belongs to, so i'm posting to -hackers and
> -stable.
>
> i've noticed for a while now that during heavy activity (for instance
> buildworld), that top will get these kvm_read errors when reading proc
> mem entries.

Hi.
I think that is a question of whether it's acceptable to hide all errors
originated in kvm(3):

Index: usr.bin/top/machine.c
===================================================================
--- usr.bin/top/machine.c   (revision 222893)
+++ usr.bin/top/machine.c   (working copy)
@@ -265,7 +265,7 @@
        else if (namelength > UPUNAMELEN)
                namelength = UPUNAMELEN;

-       kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
+       kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
        if (kd == NULL)
                return (-1);

Or rewrite top(1) a little more to open kvm with kvm_openfiles(), to let
the caller decide itself in what places it needs to print an error with
kvm_geterr().

>
> i have included a screenshot of what happens during such events...
>
> last pid: 92024;  load averages:  4.79,  4.58,
> 4.10
> up 0+00:49:07  15:30:53
> 225 processes: 10 running, 197 sleeping, 18 waiting
> CPU: 90.6% user,  0.0% nice,  9.4% system,  0.0% interrupt,  0.0% idle
> Mem: 493M Active, 1337M Inact, 604M Wired, 632K Cache, 315M Buf, 524M Free
> Swap: 4097M Total, 4097M Free
> kvm_open: cannot open /proc/86755/mem
>  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
> 91943 root          1  97    0 39536K 33620K RUN     1   0:01  7.37%
> [cc1plus]
> 2859 jbryant       1  48    0   406M 72332K select  0   3:10  5.96%
> kwin -session 1028b2382461f5000127042056000000019550000_13
> 2747 root          1  46    0   419M   370M select  0   1:43  4.39%
> /usr/local/bin/X :0 -nolisten tcp -auth /var/run/xauth/A:0
> 1464 root          1  44    0  8068K  1384K select  0   0:03  0.39%
> /usr/sbin/moused -p /dev/ums0 -t auto -I /var/run/moused.u
> 11219 jbryant       7  44    0   299M   109M select  1   0:17  0.29%
> /usr/local/lib/thunderbird/thunderbird-bin
> 2865 jbryant       1  45    0   453M 86140K select  0   0:21  0.20%
> kdeinit4: kdeinit4: plasma-desktop (kdeinit4)
> 2882 jbryant       1  44    0   391M 60996K select  0   0:17  0.10%
> kdeinit4: kdeinit4: kmix -session 102511e52251c60001304471
> 92001 root          1  97    0 23452K 22256K CPU1    1   0:00  0.00% [cc1]
> 92017 root          1  96    0 16172K 13440K RUN     0   0:00  0.00% [cc1]
>
[snip]

-- 
wbr,
pluknet


More information about the freebsd-stable mailing list