From owner-freebsd-hackers@freebsd.org Sun Nov 18 00:42:00 2018 Return-Path: Delivered-To: freebsd-hackers@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 9FD8B110DAB0 for ; Sun, 18 Nov 2018 00:42:00 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic315-21.consmr.mail.ne1.yahoo.com (sonic315-21.consmr.mail.ne1.yahoo.com [66.163.190.147]) (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 DDA0E89C42 for ; Sun, 18 Nov 2018 00:41:59 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: fHYIUTAVM1llHEvusd010khDBTsT2Hqd8ArVO2um0qkqY.K_M_o0w0Q4oECgP6b TgtQRn_IjcJZhpVnoBDQjVDpWYdcKisnGPwKgttq0JiAWSy6JpfrPhFWea1RyZTdXD8uOuqklHtD q_6NtCS0haITxRqmZ8sQ.7TL3vLpnp81MUuwjbyHwROK78M.yzje4XDTPdrMj6PctKo3SH6HvRIe 8sNrP1KpMAHoeDypzQLxIFyJ8Zp9KkHKLtHKkF4TarAGZWVqNsJcZbm5kSquBcPAPBah2t_bhDtr nwVEwylY5zouuKzWKV5VRqIxIEtXeMry9KuCdcBlKN6dl6Hp253zUIzj2CkJbBTYghq4dF2b00YS 9WJvavzCHZ.6LxQI9eKD557isuTHmjqJyg.lvifhp3roQgix8Zo0u5Xv4Bo_FQeIXCVL5g.kaPkc Yao24ypmSyqN.LW4L2t4O06jWJReXudo3R9jUyaRUKpU5FzUs4BWXoAELtBsSkRt8MxvEHGoSJKG psXbl352v860yqTg3saMQ.rVJhj9VUb7WqsbjdsYITSmheyvaJ73LIvEKhN1rp2nTL.pnsFMv5rN hvrTFrqfQki2XKy9jMHCi80aDAR_F7XU0_VVf7uk_9Y5AciLi5L6PfRl49e2uJTzNdCVIVGtiPgR CZpeTPTSSkiBih9Yy95IM1sALgKcRfHJP1gJUjqOSxtcxTc3I716uJE9FLluXGFlu_S7pWL4IukE Uo8eOWBuBrFzCq_JxvcQyrG8fMYSgCK0ImLWj35o2OfrYmN5ea.b7iZtKJLn5uiD.6Gel3tr9iyj t6h.PUlYlB2lDwKSr7I24YA44AsYv9PB.aQvPgdCIth0c4qpY0nextzB36Hc2OF5tUVnwQlyNfGL b60t0I2nZAUYuXKpC3bWEmQTVBI1sf9ECFy0VEjG4QdeHQBNgus8z_fzJFdDO.aGSo3.ApAI39_. hf_ZSmd_32wZlGCbl7zXkrEEr7pLb0kFSmpDNL_DQXz2AzazYtKcIQySgqOOgkfYUd3TLAr7j_NC zzptuKikDuFAHKY2sImv.1PtKrNOiJTkTjH4PNWIGPpKTkq9.07dTZI0- Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Sun, 18 Nov 2018 00:41:58 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.25]) ([76.115.7.162]) by smtp406.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 8ec4251bca550b848f230a10789d5767; Sun, 18 Nov 2018 00:41:56 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: 13-CURRENT: several GB swap being used despite plenty of free RAM From: Mark Millard In-Reply-To: <20181118001318.GB2799@raichu> Date: Sat, 17 Nov 2018 16:41:55 -0800 Cc: Ian Lepore , Rebecca Cran , freebsd-hackers Hackers , Wojciech Puchar Content-Transfer-Encoding: 7bit Message-Id: References: <1748688.u6MfGjpqfb@photon.int.bluestop.org> <1542499188.56571.59.camel@freebsd.org> <20181118001318.GB2799@raichu> To: Mark Johnston X-Mailer: Apple Mail (2.3445.101.1) X-Rspamd-Queue-Id: DDA0E89C42 X-Spamd-Result: default: False [1.88 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_FROM(0.00)[yahoo.com]; NEURAL_SPAM_SHORT(0.87)[0.868,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; RCVD_IN_DNSWL_NONE(0.00)[147.190.163.66.list.dnswl.org : 127.0.5.0]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; IP_SCORE(1.53)[ip: (4.28), ipnet: 66.163.184.0/21(1.92), asn: 36646(1.53), country: US(-0.10)]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2018 00:42:00 -0000 On 2018-Nov-17, at 16:13, Mark Johnston wrote: > > On Sat, Nov 17, 2018 at 04:59:48PM -0700, Ian Lepore wrote: >> On Sat, 2018-11-17 at 22:52 +0100, Wojciech Puchar wrote: >>> freebsd will not swap with that lots of free ram. >>> but it's 90GB free NOW, how about before? >>> >> >> Your information is outdated. For at least a couple years now (since >> approximately the 10.1 - 10.2 timeframe is my vague estimate), freebsd >> will page out application memory that hasn't been referenced for some >> time, even when the system has no shortage of free memory at all. > > No, FreeBSD will only ever swap when there is a free page shortage. The > difference is that we now slowly age unreferenced pages into the > inactive queue, which makes them candidates for pageout and subsequent > eviction. With pageout_update_period=0, anonymous memory won't get > paged out unless there's a shortage of inactive pages, or an application > calls madvise(MADV_DONTNEED) on a range of memory (which moves any > backing pages to the inactive queue). Swapping is built on top of paging as I understand. The system can page without swapping but can not swap without (effectively) paging to implement the swapping, if I understand right. If I understand right, swapped-out means that kernel stacks have been written out and have to be loaded back in RAM before the process/threads can even run. (I might not understand.) If I've got that right, are there distinctions here for paging that is not part of swapping vs. actual swapping (and its use of paging)? Saying that something does not swap does not necessarily imply that it does not page: it still could have paging activity that does not include moving the kernel stacks for the process to backing media? At times I have trouble interpreting when wording goes back and forth between swapping and paging, both for the intended meaning and for the technical implications. >> The advice I was recently given to revert to the old behavior is: >> >> sysctl vm.pageout_update_period=0 >> >> I've been using it on a couple systems here for a few days now, and so >> far results are promising, I am no longer seeing gratuitous swapfile >> usage on systems that have so much free physical ram that they should >> never need to page anything out. I haven't yet pushed one of those >> systems hard enough to check what happens when they do need to start >> proactively paging out inactive memory due to shortages -- it could be >> that turning off the new behavior has downsides for some workloads. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)