FreeBSD on 64MB memory

Eugene Grosbein eugen at grosbein.net
Mon Feb 12 18:04:48 UTC 2018


13.02.2018 0:38, Ask Bjørn Hansen wrote:

>>> I have an old Soekris system with 64MB memory that I upgraded from 10.3 to 11.1 recently. Since then it’s started hanging every few days.
>> Please show output of commands:
>>
>> grep memory /var/run/dmesg.boot
> 
> real memory  = 67108864 (64 MB)
> avail memory = 42098688 (40 MB)
> 
> The 24MB are for the kernel?  I wonder my 11.1 kernel is less discriminating with what I compiled in...

You should be running custom kernel with absolute minimum.
For example, use "options NO_SWAPPING" to compile out swapping code if your system
cannot have any swap area.

>> top -ores -d1
> 
> Shortly after boot:
> 
> last pid:  1008;  load averages:  0.57,  0.62,  0.53    up 0+00:19:31  06:24:50
> 8 processes:   1 running, 7 sleeping
> CPU:     % user,     % nice,     % system,     % interrupt,     % idle
> Mem: 9084K Active, 3644K Inact, 29M Wired, 4862K Buf, 492K Free
> Swap:
> 
>   PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
>   911 root        1  22    0  8816K  8844K select   0:39   4.20% ntpd

Your Soekris system can live without bloated ntpd, use ntpdate or try sntp
to periodically check your clock with cron, unless you need to re-distribute
NTP to your LAN.

>   959 root        1  52    0 10756K  5196K select   0:00   0.00% sshd
>   709 root        1  20    0  7300K  3224K select   0:00   0.00% devd

Stop using devd (devd_enable="NO"), Soekris system does not need it, at all.

>> sysctl kern.ipc.nmbclusters
> 
> kern.ipc.nmbclusters: 898

Way too low. You should double this at very least.

>> It would be also very useful to obtain output of "vmstat -z" in a moment of breakage.

> ITEM                   SIZE  LIMIT     USED     FREE      REQ FAIL SLEEP

> audit_record:          1112,      0,       0,       0,       0,   0,   0

Remove "options AUDIT" from the kernel config unless you really use this.
Same for every other non-mandatory kernel option including PF that may be
loaded using kernel modules.

> mbuf_packet:            256,   5745,     259,       0,  418909,   2,   0
> mbuf:                   256,   5745,     263,     273,  773249,  18,   0
> mbuf_cluster:          2048,    898,     259,     131,  204839,1868,   0

This is very bad as FreeBSD TCP/IP stack just live-locks when it runs
out of mbufs/mbuf clusters. You want to eliminate mbuf* allocation failures at any cost.


> ===================================
> ~25 minutes after boot:
> 
> ntp1.us.grundclock.com# vmstat -z
> ITEM                   SIZE  LIMIT     USED     FREE      REQ FAIL SLEEP
> mbuf_packet:            256,   5745,     128,     253,   32698,   0,   0
> mbuf:                   256,   5745,       1,     263,   57270,   0,   0
> mbuf_cluster:          2048,    898,     381,       3,     726,   0,   0

This is very strange because FAIL counters should not decrease.




More information about the freebsd-stable mailing list