From owner-freebsd-questions@freebsd.org Fri Aug 21 15:02:42 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F38E43BFABE for ; Fri, 21 Aug 2020 15:02:42 +0000 (UTC) (envelope-from doug@safeport.com) Received: from bucksport.safeport.com (bucksport.safeport.com [198.74.231.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BY4WQ1dYzz4351 for ; Fri, 21 Aug 2020 15:02:41 +0000 (UTC) (envelope-from doug@safeport.com) Received: from bucksport.safeport.com (bucksport.safeport.com [198.74.231.101]) by bucksport.safeport.com (8.14.5/8.14.5) with ESMTP id 07LF2XvE064036 for ; Fri, 21 Aug 2020 11:02:33 -0400 (EDT) (envelope-from doug@safeport.com) Date: Fri, 21 Aug 2020 11:02:33 -0400 (EDT) From: Doug Denault To: freebsd-questions@FreeBSD.ORG Subject: Re: Swapping when memory is idle?? Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (bucksport.safeport.com [198.74.231.101]); Fri, 21 Aug 2020 11:02:33 -0400 (EDT) X-Rspamd-Queue-Id: 4BY4WQ1dYzz4351 X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of doug@safeport.com designates 198.74.231.101 as permitted sender) smtp.mailfrom=doug@safeport.com X-Spamd-Result: default: False [1.77 / 15.00]; FAKE_REPLY(1.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.23)[-0.228]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:198.74.231.101]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[safeport.com]; NEURAL_SPAM_SHORT(0.10)[0.103]; RCVD_COUNT_ONE(0.00)[1]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11288, ipnet:198.74.228.0/22, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; MAILMAN_DEST(0.00)[freebsd-questions]; ONCE_RECEIVED(0.10)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 15:02:43 -0000 On Fri, 21 Aug 2020, Steve O'Hara-Smith wrote: > On Fri, 21 Aug 2020 07:02:42 +0200 > Polytropon wrote: > > > On Thu, 20 Aug 2020 12:40:32 -0600, @lbutlr wrote: > > > Once a page is in swap it will stay there until it is needed. > > > > Or until the operator deactivates and reactivates swap (using > > the swapoff / swapon programs), which would lead to anything > > still in swap being "synced" with RAM as long as there is enough > > capacity to hold them. THis is of course a heavy interference > > with how the OS manages memory, and often not a good idea. ;-) > > The only time it's a good idea IME is just after some event has > almost but not quite triggered the OOM killer before releasing memory so > far too much has been swapped out. It will come back as needed of course > but recovery is smoother if you force it all back with swapoff. The handbook and something (now lost in the google-sphere) I read suggests that modfied pages a "pre-paged" out just in case. I believe this change was made circa 10.x or later. I have some older systems to support outdated Druple-s and an ecommerce program. They show 0% or close enough. A semi-busy postfix/cyrus system show 0% swapspace used. A 12.1 version with a similiar load shows 13%. Apache/php systems will page fault their way through new process creation continuously. In system that was enough memory where they would never page (in the traditional sense of the word) show a very large number of swapout. 'vmstat -s' will show what's going on in this regard. I have an 11.1 system running apache/php on several jails that is sitting at 40% swapfile usage. It has filled swapspace one and would have a second time except from monitoring. That is an issue/bug _____ Douglas Denault http://www.safeport.com doug@safeport.com Voice: 301-217-9220 Fax: 301-217-9277