What do top's %MEM and VSZ mean?

103,091

Solution 1

The man page you refer to comes from the procps version of top.

But you're on an embedded system, so you have the busybox version of top.

It looks like busybox top calculates %MEM as VSZ/MemTotal instead of RSS/MemTotal.

The latest version of busybox calls that column %VSZ to avoid some confusion. commit log

Solution 2

It is likely that rstpd has a lot of dynamic libraries linked to it, but they have not been loaded into memory yet.

See Why the value of VSIZE in top is different from the value of VSZ (Virtual set size) in ps?

What does ps aux show for that process?

Share:
103,091

Related videos on Youtube

djf
Author by

djf

Updated on September 18, 2022

Comments

  • djf
    djf almost 2 years

    I'm working on an embedded Linux system (128MB RAM) without any swap partition. Below is its top output:

    Mem: 37824K used, 88564K free, 0K shrd, 0K buff, 23468K cached
    CPU:   0% usr   0% sys   0% nic  60% idle   0% io  38% irq   0% sirq
    Load average: 0.00 0.09 0.26 1/50 1081
      PID  PPID USER     STAT   VSZ %MEM CPU %CPU COMMAND
     1010     1 root     S     2464   2%   0   8% -/sbin/getty -L ttyS0 115200 vt10
     1081  1079 root     R     2572   2%   0   1% top
        5     2 root     RW<      0   0%   0   1% [events/0]
     1074   994 root     S     7176   6%   0   0% sshd: root@ttyp0
     1019     1 root     S    13760  11%   0   0% /SecuriWAN/mi
      886     1 root     S     138m 112%   0   0% /usr/bin/rstpd 51234  <== 112% MEM?!?
     1011   994 root     S     7176   6%   0   0% sshd: root@ttyp2
      994     1 root     S     4616   4%   0   0% /usr/sbin/sshd
     1067  1030 root     S     4572   4%   0   0% ssh passive
      932     1 root     S     4056   3%   0   0% /sbin/ntpd -g -c /etc/ntp.conf
     1021     1 root     S     4032   3%   0   0% /SecuriWAN/HwClockSetter
      944     1 root     S     2680   2%   0   0% dbus-daemon --config-file=/etc/db
     1030  1011 root     S     2572   2%   0   0% -sh
     1079  1074 root     S     2572   2%   0   0% -sh
        1     0 root     S     2460   2%   0   0% init
      850     1 root     S     2460   2%   0   0% syslogd -m 0 -s 2000 -b 2 -O /var
      860     1 root     S     2460   2%   0   0% klogd -c 6
      963     1 root     S     2184   2%   0   0% /usr/bin/vsftpd /etc/vsftpd.conf
        3     2 root     SW<      0   0%   0   0% [ksoftirqd/0]
      823     2 root     SWN      0   0%   0   0% [jffs2_gcd_mtd6]
    

    ps (which doesn't understand any options besides -w on busybox) shows:

      PID USER       VSZ STAT COMMAND
        1 root      2460 S    init
        2 root         0 SW<  [kthreadd]
        3 root         0 SW<  [ksoftirqd/0]
        4 root         0 SW<  [watchdog/0]
        5 root         0 SW<  [events/0]
        6 root         0 SW<  [khelper]
       37 root         0 SW<  [kblockd/0]
       90 root         0 SW   [pdflush]
       91 root         0 SW   [pdflush]
       92 root         0 SW<  [kswapd0]
      137 root         0 SW<  [aio/0]
      146 root         0 SW<  [nfsiod]
      761 root         0 SW<  [mtdblockd]
      819 root         0 SW<  [rpciod/0]
      823 root         0 SWN  [jffs2_gcd_mtd6]
      850 root      2460 S    syslogd -m 0 -s 2000 -b 2 -O /var/log/syslog
      860 root      2460 S    klogd -c 6
      886 root      138m S    /usr/bin/rstpd 51234
      945 root      2680 S    dbus-daemon --config-file=/etc/dbus-system.conf --for
      964 root      2184 S    /usr/bin/vsftpd /etc/vsftpd.conf
      984 root      4616 S    /usr/sbin/sshd
      987 root       952 S    /sbin/udhcpd /ftp/dhcpd.conf
     1002 root      4056 S    /sbin/ntpd -g -c /ftp/ntp.conf
     1022 root      2464 S    -/sbin/getty -L ttyS0 115200 vt102
     1023 root      7176 S    sshd: root@ttyp0
     1028 root      2572 S    -sh
     1030 root      2572 R    ps
    

    When you look at process 886, you see that it uses 112% of the availble memory and has VSZ (virtual memory size) of 138MB. That doesn't make any sense to me.

    In the top man page it says:

    %MEM -- Memory usage (RES) A task's currently used share of available physical memory.

    How can this process consume more than 100% memory? And if it's such a memory hog, why are there still 88564K RAM free on the system?