From owner-freebsd-stable@freebsd.org Mon Feb 12 18:04:48 2018 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA924F0DB31 for ; Mon, 12 Feb 2018 18:04:47 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6244C82855 for ; Mon, 12 Feb 2018 18:04:46 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w1CI4Y95029292 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2018 19:04:34 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: ask@develooper.com Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w1CI4TAb039089 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 13 Feb 2018 01:04:29 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: FreeBSD on 64MB memory To: =?UTF-8?Q?Ask_Bj=c3=b8rn_Hansen?= References: <5FB97479-C49D-4C6E-8416-015ECA656C14@develooper.com> <5A8123CE.9050609@grosbein.net> Cc: freebsd-stable@freebsd.org From: Eugene Grosbein Message-ID: <5A81D72A.7020408@grosbein.net> Date: Tue, 13 Feb 2018 01:04:26 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00, LOCAL_FROM, RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 18:04:48 -0000 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.