From owner-freebsd-current Tue Jan 26 15:34:34 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA17927 for freebsd-current-outgoing; Tue, 26 Jan 1999 15:34:34 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from phantasm.thekeep.org (PHANTASM.ANDREW.CMU.EDU [128.2.36.218]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id PAA17917 for ; Tue, 26 Jan 1999 15:34:31 -0800 (PST) (envelope-from dar@thekeep.org) Received: (qmail 63153 invoked by uid 100); 26 Jan 1999 23:34:30 -0000 Date: Tue, 26 Jan 1999 18:34:30 -0500 From: Dan Root To: freebsd-current@FreeBSD.ORG Subject: Memory usage weirdness Message-ID: <19990126183430.A61727@thekeep.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="pWyiEgJYm5f9v55/" X-Mailer: Mutt 0.95i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Description: Mail message What would cause more memory to be considered in the active state than could be accounted for by running processes? My main machine (running -current as of the afternoon of Jan 25) has somewhere between 80 and 100 megs of memory listed as used via ps and top (which, I presume doesn't take in to account shared executable pages, but does include the 16 megs the X server is mapping on the video card), yet both top and vmstat show over 170 megs worth of memory being active. Furthermore, if I kill off my X session and associated processes, active memory usage doesn't decrease, even after 5 or more minutes. According to the vmstat manpage, 20 seconds later, the pages released would be considered inactive. Since I was curious, I wrote a small program which scanned the contents of /proc/*/map and added up the amount of memory supposedly being used by current processes, to make sure top and ps weren't confused. Sure enough, the figure was far less than the amount that was being listed active at any given time, by on the order of anywhere between 50% and 75%. Is this normal, or should I look for some process that's thrashing through vast amounts of pages in short periods of time? (For those who wish to look at it, I've attached output from various commands such as vmstat, top, ps, the contents of /proc/*/map, plus my kernel config file) -- /* Dan Root - XTEA cipher */ static unsigned D=0x9E3779B9,l=0xC6EF3720,s; /* t=64bit text, k=128bit key */ #define m(x,y) ((x<<4^x>>5)+(x^s)+k[s>>y&3]) void enc(int*t,int*k){for(s=0;s!=+l;){t[0]+=m(t[1],0);s+=D;t[1]+=m(t[0],11);}} void dec(int*t,int*k){for(s=-l;s==0;){t[1]-=m(t[0],11);s-=D;t[0]-=m(t[1],0);}} --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Description: Output from vmstat -m Content-Disposition: attachment; filename="vmstat.m" Memory statistics by bucket size Size In Use Free Requests HighWater Couldfree 16 180 76 84919 1280 0 32 411 4581 325012 640 6290 64 9208 3016 1154010 320 1103 128 824 6888 184390 160 28831 256 8504 152 317570 80 939 512 36 4 139 40 0 1K 139 281 12795 20 1159 2K 41 5 451 10 165 4K 11 1 1530 5 0 8K 5 26 4182 5 3885 16K 2 0 2 5 0 32K 3 0 3 5 0 64K 7 0 7 5 0 128K 1 0 1 5 0 Memory usage type by bucket size Size Type(s) 16 kld, devbuf, temp, proc, sysctl, shm, soname, pcb, vnodes, ether_multi, routetbl 32 kld, sigio, devbuf, temp, pgrp, subproc, sysctl, SWAP, soname, pcb, cluster_save buffer, vnodes, ifaddr, ether_multi, routetbl, in_multi, newblk, bmsafemap, indirdep, freefrag, freefile, diradd, mkdir, dirrem 64 file, lockf, namecache, devbuf, temp, session, iov, shm, soname, pcb, cluster_save buffer, vnodes, ifaddr, routetbl, pagedep, allocdirect, allocindir 128 kld, timecounter, file desc, zombie, namecache, devbuf, temp, proc, cred, ttys, soname, cluster_save buffer, vnodes, ifaddr, routetbl, inodedep, freeblks, ZONE 256 file desc, devbuf, temp, subproc, vnodes, routetbl, NFS srvsock, NFS daemon, newblk, FFS node 512 kld, devbuf, temp, proc, ioctlops, BIO buffer, mount, UFS mount 1K kld, devbuf, temp, BIO buffer, NQNFS Lease 2K devbuf, ttys, pcb, BIO buffer, UFS mount, mbuf 4K kld, devbuf, temp, ioctlops, UFS mount 8K kld, temp, pagedep, indirdep, UFS mount 16K devbuf 32K devbuf, temp, SWAP 64K ISOFS mount, kld, NFS hash, inodedep, UFS ihash, UFS quota, VM pgdata 128K namecache Memory statistics by type Type Kern Type InUse MemUse HighUse Limit Requests Limit Limit Size(s) ISOFS mount 1 64K 64K 40960K 1 0 0 64K kld 16 79K 84K 40960K 39 0 0 16,32,128,512,1K,4K,8K,64K timecounter 5 1K 1K 40960K 5 0 0 128 file desc 72 10K 12K 40960K 61972 0 0 128,256 file 183 12K 15K 40960K 603245 0 0 64 sigio 2 1K 1K 40960K 17 0 0 32 zombie 0 0K 1K 40960K 61818 0 0 128 lockf 10 1K 2K 40960K 58364 0 0 64 namecache 8938 688K 784K 40960K 268805 0 0 64,128,128K devbuf 252 133K 133K 40960K 703 0 0 16,32,64,128,256,512,1K,2K,4K,16K,32K temp 157 31K 42K 40960K 57270 0 0 16,32,64,128,256,512,1K,4K,8K,32K pgrp 38 2K 2K 40960K 933 0 0 32 session 33 3K 3K 40960K 567 0 0 64 proc 14 2K 2K 40960K 590 0 0 16,128,512 subproc 77 6K 7K 40960K 123599 0 0 32,256 cred 42 6K 6K 40960K 2908 0 0 128 sysctl 0 0K 1K 40960K 940 0 0 16,32 SWAP 2 21K 21K 40960K 2 0 0 32,32K ioctlops 0 0K 4K 40960K 4 0 0 512,4K iov 0 0K 1K 40960K 10 0 0 64 shm 2 1K 1K 40960K 827 0 0 16,64 ttys 641 84K 84K 40960K 2045 0 0 128,2K soname 10 1K 1K 40960K 74789 0 0 16,32,64,128 pcb 37 5K 5K 40960K 7183 0 0 16,32,64,2K BIO buffer 160 188K 419K 40960K 12494 0 0 512,1K,2K cluster_save buffer 0 0K 1K 40960K 9756 0 0 32,64,128 mount 5 3K 3K 40960K 5 0 0 512 vnodes 68 8K 26K 40960K 2973 0 0 16,32,64,128,256 ifaddr 10 1K 1K 40960K 10 0 0 32,64,128 ether_multi 7 1K 1K 40960K 7 0 0 16,32 routetbl 145 19K 29K 40960K 1412 0 0 16,32,64,128,256 in_multi 2 1K 1K 40960K 2 0 0 32 NFS srvsock 2 1K 1K 40960K 2 0 0 256 NFS daemon 1 1K 1K 40960K 1 0 0 256 NQNFS Lease 1 1K 1K 40960K 1 0 0 1K NFS hash 1 64K 64K 40960K 1 0 0 64K pagedep 3 9K 24K 40960K 6595 0 0 64,8K inodedep 5 65K 639K 40960K 41384 0 0 128,64K newblk 1 1K 1K 40960K 163836 0 0 32,256 bmsafemap 1 1K 2K 40960K 7033 0 0 32 allocdirect 1 1K 166K 40960K 105078 0 0 64 indirdep 0 0K 209K 40960K 7413 0 0 32,8K allocindir 0 0K 131K 40960K 58757 0 0 64 freefrag 0 0K 9K 40960K 35964 0 0 32 freeblks 0 0K 332K 40960K 13325 0 0 128 freefile 0 0K 82K 40960K 11186 0 0 32 diradd 2 1K 53K 40960K 19268 0 0 32 mkdir 0 0K 6K 40960K 844 0 0 32 dirrem 1 1K 144K 40960K 13384 0 0 32 FFS node 8389 2098K 2130K 40960K 247609 0 0 256 UFS ihash 1 64K 64K 40960K 1 0 0 64K UFS quota 1 64K 64K 40960K 1 0 0 64K UFS mount 12 26K 26K 40960K 12 0 0 512,2K,4K,8K VM pgdata 1 64K 64K 40960K 1 0 0 64K ZONE 19 3K 3K 40960K 19 0 0 128 mbuf 1 2K 2K 40960K 1 0 0 2K Memory Totals: In Use Free Requests 3816K 1737K 2085011 --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Description: Output from vmstat -s Content-Disposition: attachment; filename="vmstat.s" 4123448 cpu context switches 23506677 device interrupts 2882703 software interrupts 3789127 traps 46970380 system calls 10 swap pager pageins 10 swap pager pages paged in 17 swap pager pageouts 19 swap pager pages paged out 8357 vnode pager pageins 51568 vnode pager pages paged in 0 vnode pager pageouts 0 vnode pager pages paged out 183 page daemon wakeups 327791 pages examined by the page daemon 164615 pages reactivated 1094388 copy-on-write faults 213960 copy-on-write optimized faults 1604322 zero fill pages zeroed 46244 zero fill pages prezeroed 33 intransit blocking page faults 3550488 total VM faults taken 3719017 pages freed 187 pages freed by daemon 93319 pages freed by exiting processes 43771 pages active 10572 pages inactive 2974 pages in VM cache 5827 pages wired down 876 pages free 4096 bytes per page 4289817 total name lookups cache hits (84% pos + 8% neg) system 2% per-directory deletions 0%, falsehits 0%, toolong 0% --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Description: Output from top Content-Disposition: attachment; filename=top last pid: 61803; load averages: 0.00, 0.13, 0.13 up 0+20:05:27 17:27:46 56 processes: 1 running, 55 sleeping Mem: 171M Active, 41M Inact, 23M Wired, 12M Cache, 8319K Buf, 3960K Free Swap: 64M Total, 192K Used, 64M Free PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND 227 root 2 0 31124K 26664K select 1 12:31 0.15% 0.15% XF86_SVGA 269 dar 10 0 1756K 960K nanslp 0 1:48 0.00% 0.00% wmmixer 268 dar 10 0 1904K 1096K nanslp 1 1:32 0.00% 0.00% wmtime 270 dar 2 0 2692K 1572K select 1 1:21 0.00% 0.00% xterm 278 dar 2 0 1920K 1356K select 1 0:45 0.00% 0.00% screen-3.7.4 260 dar 2 0 2964K 1524K select 0 0:41 0.00% 0.00% wmaker 178 root 2 0 784K 320K select 1 0:21 0.00% 0.00% moused 218 root 2 0 1492K 920K select 1 0:19 0.00% 0.00% zephyrd 279 dar 2 0 1332K 892K select 0 0:16 0.00% 0.00% vt 99 root 2 -12 1040K 544K select 1 0:11 0.00% 0.00% xntpd 52765 root 2 0 3344K 1216K select 0 0:09 0.00% 0.00% httpd 190 qmails 2 0 836K 384K select 0 0:07 0.00% 0.00% qmail-send 94 bind 2 0 1768K 1112K select 1 0:05 0.00% 0.00% named 59890 root 2 0 1108K 528K select 0 0:04 0.00% 0.00% telnetd 59895 jason 2 0 2040K 884K select 0 0:03 0.00% 0.00% zwgc 201 root 2 0 1344K 684K select 1 0:03 0.00% 0.00% sshd1 197 root 2 0 780K 284K select 1 0:02 0.00% 0.00% qmail-lspawn 61222 dar 2 0 1676K 1200K select 0 0:02 0.00% 0.00% ssh1 59891 jason 3 0 1304K 884K ttyin 0 0:02 0.00% 0.00% tcsh 224 root 2 0 2244K 1004K select 0 0:02 0.00% 0.00% xdm 191 qmaill -6 0 768K 324K piperd 0 0:02 0.00% 0.00% cyclog 145 root 10 0 988K 488K nanslp 0 0:02 0.00% 0.00% cron 196 qmaill -6 0 752K 228K piperd 1 0:01 0.00% 0.00% accustamp 280 dar 10 0 1144K 616K wait 1 0:01 0.00% 0.00% rc 52790 root 10 0 1140K 616K wait 0 0:01 0.00% 0.00% rc 220 root 2 0 1020K 564K select 1 0:01 0.00% 0.00% zhm 60354 dar 2 0 1688K 1204K select 0 0:01 0.00% 0.00% ssh1 89 root 2 0 816K 472K select 0 0:01 0.00% 0.00% syslogd 213 root 10 0 848K 420K nanslp 1 0:01 0.00% 0.00% idled 61678 dar 3 0 1132K 772K ttyin 0 0:01 0.00% 0.00% rc 189 qmaild 2 0 792K 344K accept 1 0:01 0.00% 0.00% tcpserver 199 qmailq -6 0 768K 328K piperd 1 0:00 0.00% 0.00% qmail-clean 61727 dar 10 0 1712K 1344K wait 0 0:00 0.00% 0.00% mutt 198 qmailr 2 0 776K 260K select 0 0:00 0.00% 0.00% qmail-rspawn 117 root 2 0 1052K 624K select 1 0:00 0.00% 0.00% kerberos 1 root 10 0 496K 112K wait 1 0:00 0.00% 0.00% init 61489 nobody 2 0 3344K 1440K select 1 0:00 0.00% 0.00% httpd 142 root 2 0 860K 428K select 0 0:00 0.00% 0.00% inetd 53333 dar 10 0 1128K 540K wait 0 0:00 0.00% 0.00% rc 244 dar 10 0 1040K 396K wait 1 0:00 0.00% 0.00% rc 61397 nobody 18 0 3344K 1424K lockf 0 0:00 0.00% 0.00% httpd 61527 nobody 18 0 3344K 1416K lockf 0 0:00 0.00% 0.00% httpd 54589 dar 10 0 1128K 552K wait 1 0:00 0.00% 0.00% rc 61803 root 31 0 1564K 688K CPU1 0 0:00 0.00% 0.00% top 271 dar 10 0 1116K 544K wait 0 0:00 0.00% 0.00% rc 52784 dar 10 0 1128K 548K wait 1 0:00 0.00% 0.00% rc 215 root 2 0 1460K 712K select 1 0:00 0.00% 0.00% xfs 228 root 10 0 2268K 1216K wait 1 0:00 0.00% 0.00% xdm 61729 dar 2 0 1268K 860K select 1 0:00 0.00% 0.00% vim 261 root 2 0 1124K 508K select 0 0:00 0.00% 0.00% kadmind 61582 nobody 18 0 3344K 1404K lockf 0 0:00 0.00% 0.00% httpd 61583 nobody 18 0 3344K 1420K lockf 0 0:00 0.00% 0.00% httpd 60825 dar 18 0 1148K 648K pause 0 0:00 0.00% 0.00% screen-3.7.4 223 root 3 0 824K 468K ttyin 1 0:00 0.00% 0.00% getty 254 dar 2 0 1200K 540K select 1 0:00 0.00% 0.00% ssh-agent1 61728 dar 10 0 496K 184K wait 0 0:00 0.00% 0.00% sh --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Description: Output from dmesg Content-Disposition: attachment; filename=dmesg Copyright (c) 1992-1999 FreeBSD Inc. Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. FreeBSD 4.0-CURRENT #2: Mon Jan 25 20:40:14 EST 1999 dar@phantasm.thekeep.org:/usr/src/sys/compile/PHANTASM Timecounter "i8254" frequency 1193120 Hz CPU: Pentium Pro (686-class CPU) Origin = "GenuineIntel" Id = 0x619 Stepping=9 Features=0xfbff real memory = 268435456 (262144K bytes) config> quit avail memory = 258490368 (252432K bytes) Programming 24 pins in IOAPIC #0 FreeBSD/SMP: Multiprocessor motherboard cpu0 (BSP): apic id: 0, version: 0x00040011, at 0xfec08000 cpu1 (AP): apic id: 4, version: 0x00040011, at 0xfec08000 io0 (APIC): apic id: 13, version: 0x00170011, at 0xfec00000 Preloaded elf kernel "kernel" at 0xf02df000. ccd0-3: Concatenated disk drivers Probing for devices on PCI bus 0: chip0: rev 0x02 on pci0.0.0 fxp0: rev 0x01 int a irq 18 on pci0.6.0 fxp0: Ethernet address 00:a0:c9:06:b6:a5 chip1: rev 0x01 on pci0.7.0 ide_pci0: rev 0x00 on pci0.7.1 ahc0: rev 0x00 int a irq 17 on pci0.9.0 ahc0: aic7880 Wide Channel A, SCSI Id=15, 16/255 SCBs bt0: rev 0x08 int a irq 16 on pci0.11.0 bt0: BT-948 FW Rev. 5.06I Ultra Narrow SCSI Host Adapter, SCSI ID 7, 192 CCBs vga0: rev 0x03 int a irq 19 on pci0.19.0 Probing for PnP devices: CSN 1 Vendor ID: CSC0b36 [0x360b630e] Serial 0xffffffff Comp ID: @@@0000 [0x00000000] mss_attach 1 at 0x530 irq 5 dma 1:0 flags 0x10 pcm1 (CS423x/Yamaha/AD1816 sn 0xffffffff) at 0x530-0x537 irq 5 drq 1 flags 0x10 on isa Probing for devices on the ISA bus: sc0 on isa sc0: VGA color <16 virtual consoles, flags=0x0> atkbdc0 at 0x60-0x6f on motherboard atkbd0 irq 1 on isa psm0 irq 12 on isa psm0: model Generic PS/2 mouse, device ID 0 sio0 at 0x3f8-0x3ff irq 4 flags 0x10 on isa sio0: type 16550A sio1 at 0x2f8-0x2ff irq 3 on isa sio1: type 16550A fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa wdc0 at 0x1f0-0x1f7 irq 14 flags 0x80ff80ff on isa wdc0: unit 0 (wd0): , 32-bit, multi-block-16 wd0: 16124MB (33022080 sectors), 32760 cyls, 16 heads, 63 S/T, 512 B/S wdc1 at 0x170-0x177 irq 15 flags 0x80ff80ff on isa wdc1: unit 0 (wd2): , 32-bit, multi-block-16 wd2: 1221MB (2501856 sectors), 2482 cyls, 16 heads, 63 S/T, 512 B/S vga0 at 0x3b0-0x3df maddr 0xa0000 msize 131072 on isa npx0 on motherboard npx0: INT 16 interface joy0 at 0x201 on isa joy0: joystick APIC_IO: routing 8254 via 8259 on pin 0 SMP: AP CPU #1 Launched! sa0 at bt0 bus 0 target 1 lun 0 sa0: Removable Sequential Access SCSI-2 device sa0: 6.756MB/s transfers (6.756MHz, offset 15) changing root device to wd0s1a ffs_mountfs: superblock updated for soft updates ffs_mountfs: superblock updated for soft updates cd0 at bt0 bus 0 target 4 lun 0 cd0: Removable CD-ROM SCSI-2 device cd0: 5.0MB/s transfers (5.0MHz, offset 15) cd0: Attempt to query device size failed: NOT READY, Medium not present --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Description: Output from ps -axlw Content-Disposition: attachment; filename="ps.axlw" UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND 0 0 0 0 -18 0 0 0 sched DLs ?? 0:00.24 (swapper) 0 1 0 0 10 0 496 112 wait Is ?? 0:00.21 /sbin/init -- 0 2 0 0 -18 0 0 0 psleep DL ?? 0:04.40 (pagedaemon) 0 3 0 1 18 0 0 0 psleep DL ?? 0:00.00 (vmdaemon) 0 4 0 0 18 0 0 0 syncer DL ?? 1:11.68 (syncer) 0 89 1 0 2 0 816 472 select Ss ?? 0:00.99 syslogd -u 10 94 1 0 2 0 1768 1112 select Ss ?? 0:05.28 named -u bind -g bind 0 99 1 42 2 -12 1040 544 select S