Subject: memory allocation question
To: None <port-hpcmips@netbsd.org>
From: Tim Underwood <TimU@hightouchinc.com>
List: port-hpcmips
Date: 08/11/2004 11:41:22
Trying to find out how memory gets allocated, and what I can do about
it.  What I'm specifically targeting here is disk allocation.  I
searched netbsd.org for "disk cache allocation", and couldn't find
anything that seemed relevant.

My system is a MobilePro 880, with 32MB of memory, running a 2GB PCMCIA
hard drive, and a CF Wireless Ether card.  I am running NetBSD
1.6.2_STABLE (GENERIC), nightly build from Jul 12.

When in text mode, I run "top", and a line is displayed that shows:

Memory: 11M Act, 132K Wired, 3012K Exec, 6676K File, 13M Free
Swap: 257M Total, 257M Free

I assume that means:
Using 11MB of memory, allocated to Wired, Currently Executing, and File
Buffers, leaving 13MB Free.  Not sure what "Wired" means.  (top in Linux
has a slightly different display).  Obviously, I'm not using swap.

All of that is in text mode.

When running under X, it obviously uses a bit more memory, about 6MB
more, leaving 5320K free.

Questions:

1.  How can I reduce the approx 6MB memory given over to disk cache?  In
Linux, I just echo a value out to the /proc subsystem, and it happens
dynamically.  Is NetBSD like the "old" unices, where I have to set a
value and recompile the kernel?  Or is there a dynamic way of setting
this?  On this slow a system, I don't know I'm saving a bunch of time by
going to cache instead of the disk (eventually a CF card).  I'd like to
play with that and reduce it down to about 2MB.

2.  Obviously, more memory could be saved by recompiling the kernel, and
dropping support for hardware I don't have.  Realistically, how much can
I really save by doing this?  And speaking of kernel recompiles, is
there a utility that examines a running kernel, and produces the proper
settings for that kernel?  Or is it simply a hit-and-miss affair getting
the right things in there?  (Yes, I read the FAQ about 'dmesg|grep " at
"' to find hardware, but there are a lot of other settings that won't be
found that way).

3.  I don't currently use IPv6, so how much can I realistically save by
dropping support for that?

4.  What other memory hogs can I target in the kernel to reduce memory
requirements?