Subject: Bizarre kernel memory usage
To: Chuck Silvers <chuq@chuq.com>
From: John Klos <john@ziaspace.com>
List: port-amiga
Date: 02/02/2005 12:46:35
Hi,

As a followup, I've been trying to compile kernels with KMEMSTATS. Later, 
I also tried DIAGNOSTIC and DEBUG, and something interesting happened - on 
my Amiga 4000, with KMEMSTATS and DEBUG, the system is now well behaved - 
even after compiling for a couple of days, kernel usage has hovered around 
35 megs for a system with 128 megs.

Now here's the strange thing - for mac68k, a kernel with DIAGNOSTIC, 
DEBUG, and KMEMSTATS will boot on one Quadra 605 which has 36 megs of 
memory, but not on another Quadra 605 which has 132 megs of memory. Both 
systems have identical System 7.6.1 partitions, identical bootloaders, and 
both have been working fine for months. The system with 132 megs says this 
in the boot window:

transparent = 1
Boot error: This kernel is not in a format which the booter can execute.

I double checked the kernel, recopied it, and it's not a bad copy.

Anyway, here's vmstat -m from the machine with 36 megs (right before it 
crashed). It said kernel usage was 32 megs (!)

Memory statistics by bucket size
     Size   In Use   Free   Requests  HighWater  Couldfree
       16      404    108      49679    1280          0
       32      180     76      42859     640          0
       64      423    729      41983     320       1010
      128      198     26       9005     160          0
      256       85     11      10027      80          0
      512       39      9        322      40          0
     1024      254     10       4403      20          0
     2048       19      5       3432      10          0
     4096       12      3         16       5          0
     8192        2      0          3       5          0
    16384        8      0        123       5          0
    65536        1      0          1       5          0
   131072        1      0          1       5          0

Memory usage type by bucket size
     Size  Type(s)
       16  VM swap, UVM aobj, UVM amap, ifaddr, namecache, soname, pipe, 
proc,
           in_multi, ip_moptions, UFS mount, routetbl, temp, pcb, devbuf, 
exec,
           kernfs mount, NDP
       32  VM swap, UVM amap, ifmedia, ether_multi, ifaddr, soname, 
sysctldata,
           fragtbl, routetbl, temp, pcb, devbuf
       64  UVM amap, vnodes, lockf, prop, session, in_multi, routetbl, 
temp, pcb,
           devbuf, exec, NFS diroff, NFS req, NDP
      128  VM swap, UVM amap, ifaddr, soname, ttys, prop, sysctlnode, cred, 
proc,
           routetbl, temp, devbuf, kevent, inodedep, NDP
      256  VM map, UVM amap, ifaddr, vnodes, subproc, proc, routetbl, temp,
           devbuf, exec, kevent, newblk, NFS daemon, NFS diroff
      512  UVM amap, ifaddr, mount, proc, UFS mount, temp, pcb, devbuf, 
exec,
           ioctlops, NFS mount, NFS srvsock
     1024  UVM aobj, UVM amap, ttys, sysctlnode, temp, devbuf, exec, NQNFS 
Lease
     2048  UVM amap, ifaddr, namecache, sysctlnode, in_multi, UFS mount, 
temp,
           devbuf, exec, pagedep
     4096  UVM amap, sysctlnode, UFS mount, temp, devbuf
     8192  namecache, sysctlnode, MSDOSFS mount
    16384  namecache, sysctlnode, UFS mount, temp, devbuf, UFS quota, 
inodedep,
           NFS node, ISOFS mount
    65536  temp
   131072  devbuf

Memory statistics by type                           Type  Kern
          Type  InUse MemUse HighUse  Limit Requests Limit Limit Size(s)
        VM swap     5     1K      1K  5530K        5    0     0  16,32,128
         VM map     4     1K      1K  5530K        4    0     0  256
       UVM aobj     2     2K      2K  5530K        2    0     0  16,1024
       UVM amap   761    63K     71K  5530K   123823    0     0 
16,32,64,128,256,512,1024,2048,4096
        ifmedia     1     1K      1K  5530K        1    0     0  32
    ether_multi     5     1K      1K  5530K        5    0     0  32
         ifaddr    33     9K      9K  5530K       33    0     0 
16,32,128,256,512,2048
          mount     4     2K      2K  5530K        7    0     0  512
         vnodes    45     8K     57K  5530K      854    0     0  64,256
          lockf     2     1K      1K  5530K       52    0     0  64
      namecache     4    27K     27K  5530K        4    0     0 
16,2048,8192,16384
         soname     2     1K      1K  5530K       97    0     0  16,32,128
           ttys   336   218K    218K  5530K      336    0     0  128,1024
           pipe     0     0K      1K  5530K        2    0     0  16
           prop     2     1K      1K  5530K        2    0     0  64,128
     sysctldata     0     0K      1K  5530K        1    0     0  32
     sysctlnode    46    77K     77K  5530K       65    0     0 
128,1024,2048,4096,8192,16384
           cred     8     1K      1K  5530K     1149    0     0  128
        subproc     4     1K      2K  5530K       11    0     0  256
        session    13     1K      1K  5530K       27    0     0  64
           proc     4     1K      1K  5530K        7    0     0 
16,128,256,512
       in_multi    28     3K      3K  5530K       28    0     0  16,64,2048
    ip_moptions     1     1K      1K  5530K        1    0     0  16
      UFS mount     7    31K     31K  5530K        7    0     0 
16,512,2048,4096,16384
        fragtbl     0     0K      1K  5530K     2219    0     0  32
       routetbl    73     5K      5K  5530K      103    0     0 
16,32,64,128,256
           temp    11    61K     78K  5530K    20273    0     0 
16,32,64,128,256,512,1024,2048,4096,16384,65536
            pcb    20     4K      4K  5530K      137    0     0 
16,32,64,512
         devbuf   154   159K    161K  5530K      201    0     0 
16,32,64,128,256,512,1024,2048,4096,16384,131072
           exec     1     1K      5K  5530K     6759    0     0 
16,64,256,512,1024,2048
         kevent     2     1K      1K  5530K        2    0     0  128,256
       ioctlops     0     0K      1K  5530K       12    0     0  512
      UFS quota     1    16K     16K  5530K        1    0     0  16384
         newblk     1     1K      1K  5530K        1    0     0  256
       inodedep     1    16K     17K  5530K       38    0     0  128,16384
        pagedep     1     2K      2K  5530K        1    0     0  2048
      NFS mount     1     1K      1K  5530K        1    0     0  512
    NFS srvsock     2     1K      1K  5530K        2    0     0  512
     NFS daemon     1     1K      1K  5530K        1    0     0  256
     NFS diroff    24     3K      5K  5530K      133    0     0  64,256
        NFS req     0     0K      1K  5530K     5432    0     0  64
    NQNFS Lease     1     1K      1K  5530K        1    0     0  1024
       NFS node     1    16K     16K  5530K        1    0     0  16384
  MSDOSFS mount     1     8K      8K  5530K        1    0     0  8192
   kernfs mount     1     1K      1K  5530K        1    0     0  16
    ISOFS mount     1    16K     16K  5530K        1    0     0  16384
            NDP    11     1K      1K  5530K       13    0     0  16,64,128

Memory totals:  In Use    Free    Requests
                   749K     93K      161857

Memory resource pool statistics
Name        Size Requests Fail Releases Pgreq Pgrel Npage Hiwat Minpg 
Maxpg Idle
phpool        40      104    0       39     1     0     1     1     0 
inf    0
pcgpool      140        9    0        5     1     0     1     1     0 
inf    0
vmsppl       232     4237    0     4208     2     0     2     2     0 
inf    0
vmmpepl       96   131573    0   130911    22     3    19    19     0 
inf    3
vmmpekpl      96     5274    0     5245     3     0     3     3     0 
inf    0
uaoeltpl      88        8    0        2     1     0     1     1     0 
inf    0
aobjpl        52        1    0        0     1     0     1     1     0 
inf    0
pmappl        36     4237    0     4208     1     0     1     1     0 
inf    0
amappl        40    35553    0    35301     4     1     3     3     0 
inf    0
bufpl        128    15874    0    15545    15     1    14    14     0 
inf    3
buf1k       1024        1    0        1     1     0     1     1     1 
1    1
buf2k       2048      662    0      465    12     5     7     8     1 
1    0
buf4k       4096       18    0       11     1     0     1     1     1 
1    0
buf8k       8192       30    0       23     2     1     1     2     1 
1    0
buf16k      16384     343    0      225    60    26    34    34     1 
1    0
buf32k      32768       5    0        5     3     2     1     3     1 
1    1
mbpl         256       77    0       46     4     1     3     4     1 
inf    1
mclpl       2048       24    0       12    14     4    10    10     4 
2048    4
kqueuepl     296        1    0        0     1     0     1     1     0 
inf    0
knotepl       80        5    0        0     1     0     1     1     0 
inf    0
sockpl       200      184    0      159     2     0     2     2     0 
inf    0
ttypl        264       67    0        0     5     0     5     5     0 
inf    0
rndsample    528      130    0      128     1     0     1     1     0 
inf    0
procpl       408     4246    0     4208     5     0     5     5     0 
inf    1
lwppl        128     4246    0     4208     2     0     2     2     0 
inf    0
pgrppl        16       52    0       37     1     0     1     1     0 
inf    0
pcredpl       24     4246    0     4208     1     0     1     1     0 
inf    0
plimitpl     160        5    0        2     1     0     1     1     0 
inf    0
pstatspl     224     4246    0     4208     3     0     3     3     0 
inf    0
rusgepl       72     4208    0     4208     2     1     1     1     0 
inf    1
ptimerpl     124       11    0        7     1     0     1     1     0 
inf    0
filepl        56    21650    0    21581     2     0     2     2     0 
inf    1
cwdipl        12     4237    0     4208     1     0     1     1     0 
inf    0
fdescpl      280     4237    0     4208     3     0     3     3     0 
inf    0
pnbufpl     1024        7    0        4     1     0     1     1     0 
inf    0
vnodepl      168     5744    0     3498    94     0    94    94     0 
inf    0
ncachepl      84     7286    0     5446    56    17    39    39     0 
inf    0
sdpcpool     128     4603    0     4603    21    10    11    13     0 
inf   11
pagedeppl     72      525    0      523     4     3     1     4     0 
inf    0
inodedeppl    88     6929    0     6920    78    71     7    74     0 
inf    6
newblkpl      40    16058    0    16058     1     0     1     1     0 
inf    1
bmsafemappl   36       90    0       90     1     0     1     1     0 
inf    1
allocdirectpl 80    15872    0    15872    14     6     8    10     0 
inf    8
indirdeppl    32       16    0       16     1     0     1     1     0 
inf    1
allocindirpl  72      186    0      186     1     0     1     1     0 
inf    1
freefragpl    40     2419    0     2419     1     0     1     1     0 
inf    1
freeblkspl   176     3384    0     3384   136   135     1   135     0 
inf    1
freefilepl    36     3482    0     3482    29    28     1    28     0 
inf    1
diraddpl      36     6559    0     6550     6     3     3     5     0 
inf    2
mkdirpl       32      484    0      484     1     0     1     1     0 
inf    1
dirrempl      36     6559    0     6559    28    27     1    28     0 
inf    1
newdirblkpl   20       11    0       11     1     1     0     1     0 
inf    0
ffsinopl     192    10160    0     8001   107     0   107   107     0 
inf    0
dino1pl      128    10160    0     8001    73     0    73    73     0 
inf    0
nfsnodepl    304      203    0      124     9     0     9     9     0 
inf    2
nfsvapl      112      203    0      124     4     0     4     4     0 
inf    1
ncr53c9x_ecb  52     8399    0     8399     3     0     3     3     1 
inf    3
scxspl       148     8274    0     8274     8     0     8     8     1 
inf    8
rtentpl      132       34    0        1     2     0     2     2     0 
inf    0
in6pcbpl     156       22    0       12     1     0     1     1     0 
inf    0
inpcbpl      108       41    0       32     1     0     1     1     0 
inf    0
inmltpl       32        2    0        0     1     0     1     1     0 
inf    0
ipqepl        44    13009    0    13009     1     0     1     1     0 
inf    1
tcpcbpl      316       11    0        2     1     0     1     1     0 
inf    0
tcpipqepl     44        1    0        1     1     0     1     1     0 
inf    1
synpl        184        2    0        2     1     0     1     1     0 
inf    1
sigapl      2052     4237    0     4208    33     0    33    33     0 
inf    4
extent        20       72    0       68     1     0     1     1     0 
inf    0
pipepl       144     3610    0     3602     1     0     1     1     0 
inf    0

In use 3890K, total allocated 4924K; utilization 79.0%