Skip site navigation (1)Skip section navigation (2)
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:  <>

Next in thread | Raw E-Mail | Index | Archive | Help
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
Voice: 301-217-9220
   Fax: 301-217-9277

Want to link to this message? Use this URL: <>