From owner-freebsd-arm@freebsd.org Sat Aug 4 07:15:02 2018 Return-Path: Delivered-To: freebsd-arm@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 DE82E106094D for ; Sat, 4 Aug 2018 07:15:01 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic307-2.consmr.mail.bf2.yahoo.com (sonic307-2.consmr.mail.bf2.yahoo.com [74.6.134.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C3FD89240 for ; Sat, 4 Aug 2018 07:15:01 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: pRfnMs4VM1lozsoavHuQOsomz0ff8C04BLPtJ5woZsczsYFBcq9tUqhYmBQPkSr ZlXHlMD1gNjPI4z95xFwa1HfjbSlO4FWzTdOujB2IBmKOtxLmXsTN6n._zt_ieGavBRmGOSQYeAo DIaYdsrBMNlORjEvFDTS69NiFm06pE8HUPCnb98m9ZaeZHQgvrkpgz9XVBVJQCJRLaLEqwnJ94i7 VOhv2d9yNErhtILUGy9dGKP268gXZKU3uLlsyeu0jtMHKIUdaVd.tZwQMjTXcRcEohTeqtilozPD E3Z839bDSz__lUkpw_B1aVNksSg0W2GVs06PYbXw5L9ivw09Vc3aMp7KP7xTQUZGU.yr2jGrU8wr AGC.uus4QxQgSwWJme7Wu2Aot59w9I8GSxdh_jEvCcRtPGsbrcShy3JBE7E9uRACDSKeOtqdcFRV tear0XvD0uFgPdjiXNoDS3uia3d3H.JV0GuYcdvQEc7.q5gyWpab6h6PWx9Jdht7K62F3L1HK_P3 OuGVinzDyT7z9lB2K3XTS6S6m_CQHXTJL957YIYneFFygQhgPstRX07TAuwY9hKg0vWGrl3w2owS cLoP94IgmWGn8IGkxm3BU8PYJEqNUM3_96IOWP4MRRnd9sz1vAw_MmKM3f_kI5Qi4zVHGZJUfg2F eXSTMTaQezX3rYE6QWcMWzjCjlyHJl0PUJZEFuuH73qtz5WBYwqVokGRsMgUwFEQtqphuOh5ES2G IJ21acnsXWoybg8s_r55b6Gn2472jrqvcXhrDyXTQgd8V4xnUud5c.9Oepb6Xl2IWXZPBzqZ3tsu oXXhuE6nSwl.twyhlgHp._MrtqKxi3i8Rngip.RPWxusD4UUD4lAtWUzcpXBLa0w535xsH9EtXSf d_6sQmvKkXwo8cIa_hOiexoGQY8AbVzAMN2MTWJOz2R56aewhF_DwEmoFBs0pEMvx0r748J2dZvJ mJ4NUxoklRCuPFrQIzDjnDJ96x0EF7FQT_ZWGhRk7MbWN06kqDBi2aCK969FvDatITEm5.4i6SBk ScD2Ry00bJZGKZErQKg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Sat, 4 Aug 2018 07:14:55 +0000 Received: from ip70-189-131-151.lv.lv.cox.net (EHLO [192.168.0.105]) ([70.189.131.151]) by smtp421.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 5e94443bcb52d657513d35267e5c675d; Sat, 04 Aug 2018 07:14:55 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: RPI3 swap experiments ["was killed: out of swap space" with: "v_free_count: 5439, v_inactive_count: 1"] From: Mark Millard In-Reply-To: <201808040355.w743tPsF039729@donotpassgo.dyslexicfish.net> Date: Sat, 4 Aug 2018 00:14:52 -0700 Cc: markj@freebsd.org, freebsd-arm Content-Transfer-Encoding: 7bit Message-Id: <8CC5DF53-F950-495C-9DC8-56FCA0087259@yahoo.com> References: <20180731153531.GA94742@www.zefox.net> <201807311602.w6VG2xcN072497@pdx.rh.CN85.dnsmgr.net> <20180731191016.GD94742@www.zefox.net> <23793AAA-A339-4DEC-981F-21C7CC4FE440@yahoo.com> <20180731231912.GF94742@www.zefox.net> <2222ABBD-E689-4C3B-A7D3-50AECCC5E7B2@yahoo.com> <20180801034511.GA96616@www.zefox.net> <201808010405.w7145RS6086730@donotpassgo.dyslexicfish.net> <6BFE7B77-A0E2-4FAF-9C68-81951D2F6627@yahoo.com> <20180802002841.GB99523@www.zefox.net> <20180802015135.GC99523@www.zefox.net> <201808030034.w730YURL034270@donotpassgo.dyslexicfish.net> <201808040355.w743tPsF039729@donotpassgo.dyslexicfish.net> To: Jamie Landeg-Jones , bob prohaska X-Mailer: Apple Mail (2.3445.9.1) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Aug 2018 07:15:02 -0000 On 2018-Aug-3, at 8:55 PM, Jamie Landeg-Jones wrote: > Mark Millard wrote: > >> If Inact+Laundry+Buf(?)+Free was not enough to provide sufficient >> additional RAM, I'd would have guessed that some Active Real Memory >> should then have been paged/swapped out and so RAM would be made >> available. (This requires the system to have left itself sufficient >> room in RAM for that guessed activity.) >> >> But I'm no expert at the intent or actual operation. >> >> Bob P.'s reports (for having sufficient swap space) >> also indicate the likes of: >> >> v_free_count: 5439, v_inactive_count: 1 >> >> >> So all the examples have: "v_inactive_count: 1". >> (So: vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt==1 ) > > Thanks for the feedback. I'll do a few more runs and other stress tests > to see if that result is consistent. I'm open to any other idea too! > The book "The Design and Implementation of the FreeBSD Operating System" (2nd edition, 2014) states (page labeled 296): QUOTE: The FreeBSD swap-out daemon will not select a runnable processes to swap out. So, if the set of runnable processes do not fit in memory, the machine will effectively deadlock. Current machines have enough memory that this condition usually does not arise. If it does, FreeBSD avoids deadlock by killing the largest process. If the condition begins to arise in normal operation, the 4.4BSD algorithm will need to be restored. END QUOTE. As near as I can tell, for the likes of rpi3's and rpi2's, the condition is occurring during buildworld "normal operation" that tries to use the available cores to advantage. (Your context does not have the I/O problems that Bob P.'s have had in at least some of your OOM process kill examples, if I understand right.) (4.4BSD used to swap out the runnable process that had been resident the longest, followed by the processes taking turns being swapped out. I'll not quote the exact text about such.) So I guess the question becomes, is there a reasonable way to enable the 4.4BSD style of "Swapping" for "small" memory machines in order to avoid having to figure out how to not end up with OOM process kills while also not just wasting cores by using -j1 for buildworld? In other words: enable swapping out active RAM when it eats nearly all the non-wired RAM. But it might be discovered that the performance is not better than using fewer cores during buildworld. (Experiments needed and possibly environment specific for the tradeoffs.) Avoiding having to figure out the maximum -j? that avoids OOM process kills but avoids just sticking to -j1 seems and advantage for some rpi3 and rpi2 folks. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)