Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 1996 22:55:52 +0100 (MET)
From:      Tor Egge <Tor.Egge@idt.ntnu.no>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/2137: vm statistics are bad
Message-ID:  <199612022155.WAA01725@ikke.idt.unit.no>
Resent-Message-ID: <199612022200.OAA16907@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         2137
>Category:       bin
>Synopsis:       vm statistics are bad
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec  2 14:00:02 PST 1996
>Last-Modified:
>Originator:     Tor Egge
>Organization:
Norwegian University of Science and Technology, Trondheim, Norway
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	FreeBSD ikke.idt.unit.no 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Sun Dec  1 00:54:34 MET 1996     root@ikke.idt.unit.no:/usr/src/sys-UP/compile/TEGGE  i386

>Description:

	Running systat shows bad values for total virtual memory. e.g.
        In this example, it shows 3274676 KB, while it should be 
	                      77316980216 KB.

---- systat output
    3 users    Load  0.18  0.38  0.20                  Mon Dec  2 18:35

Mem:KB    REAL            VIRTUAL                     VN PAGER  SWAP PAGER
        Tot   Share      Tot    Share    Free         in  out     in  out
Act   25168    3984  4143252     4492  329352 count
All  193988    4820  3274676     6664         pages
--- top output
 last pid:   530;  load averages:  0.14,  0.34,  0.20                   18:36:00
50 processes:  2 running, 48 sleeping
CPU states:  1.2% user,  0.0% nice,  1.2% system,  0.0% interrupt, 97.7% idle
Mem: 151M Active, 8728K Inact, 22M Wired, 8345K Buf, 322M Free
Swap: 685M Total, 64K Used, 685M Free
---- vmtotal structure contents
$1 = {t_rq = 2, t_dw = 0, t_pw = 0, t_sl = 21, t_sw = 0, t_vm = -2145615227, 
  t_avm = 1036180, t_rm = 48722, t_arm = 6262, t_vmshr = 1681, 
  t_avmshr = 1516, t_rmshr = 1217, t_armshr = 1109, t_free = 82113}
----

Using 64 bit numbers, counting the same vm objects, the result is 19329245054,
which means 73735 GB total virtual memory.

>How-To-Repeat:

   run systat.

>Fix:

Use 64 bits arithmetic in showkre() in /usr/src/usr.bin/systat/vmstat.c.
Make space for a 12 digit number showing the total virtual memory.

optional extra change in vmtotal() in /usr/src/sys/vm/vm_meter.c:
	
  By ignoring the objects where object->size == 0x7fffffff, the t_vm field
  in the vmtotal structure will have a low lower value. These objects are of
  type OBJT_VNODE, referencing vnodes of type VBLK and tag VT_UFS, referencing
  inodes for the block devices corresponding to the currently mounted ufs file
  systems. Not ignoring them means adding almost 8192 GB virtual memory for
  each mounted ufs filesystem.

  By ignoring the objects where object->ref_count == 0, you will also 
  reduce the t_vm field somewhat.

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612022155.WAA01725>