From owner-freebsd-arm@freebsd.org Sat Aug 4 14:08:43 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 5D706106C769 for ; Sat, 4 Aug 2018 14:08:43 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gate2.funkthat.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8F8A78851; Sat, 4 Aug 2018 14:08:42 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id w74E8Gs9083042 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 4 Aug 2018 07:08:16 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.15.2/8.15.2/Submit) id w74E8GVQ083041; Sat, 4 Aug 2018 07:08:16 -0700 (PDT) (envelope-from jmg) Date: Sat, 4 Aug 2018 07:08:16 -0700 From: John-Mark Gurney To: Mark Millard Cc: Jamie Landeg-Jones , bob prohaska , freebsd-arm , markj@freebsd.org Subject: Re: RPI3 swap experiments ["was killed: out of swap space" with: "v_free_count: 5439, v_inactive_count: 1"] Message-ID: <20180804140816.GJ2884@funkthat.com> Mail-Followup-To: Mark Millard , Jamie Landeg-Jones , bob prohaska , freebsd-arm , markj@freebsd.org References: <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> <8CC5DF53-F950-495C-9DC8-56FCA0087259@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8CC5DF53-F950-495C-9DC8-56FCA0087259@yahoo.com> X-Operating-System: FreeBSD 11.0-RELEASE-p7 amd64 X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7 ED9B D5FF 5A51 C0AC 3D65 X-Files: The truth is out there X-URL: https://www.funkthat.com/ X-Resume: https://www.funkthat.com/~jmg/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (gold.funkthat.com [127.0.0.1]); Sat, 04 Aug 2018 07:08:16 -0700 (PDT) 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 14:08:43 -0000 Mark Millard via freebsd-arm wrote this message on Sat, Aug 04, 2018 at 00:14 -0700: > 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. Interesting observation, maybe playing w/: vm.swap_idle_threshold2: Time before a process will be swapped out vm.swap_idle_threshold1: Guaranteed swapped in time for a process will help thing... lowering 2 will likely make the processes available for swap sooner... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."