Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2020 13:24:13 -0700
From:      Doug Hardie <>
To:        FreeBSD Mailing List <>
Subject:   Re: FreeBSD using swap even though there's a lot of free memory
Message-ID:  <>
In-Reply-To: <>
References:  <5f885b772d622_95aa2adab2b9c5b41576495c3@sirportly-app-02.mail> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

> On 16 October 2020, at 11:55, Steve O'Hara-Smith <> =
> On Fri, 16 Oct 2020 11:35:42 -0700
> Michael Sierchio <> wrote:
>> On Thu, Oct 15, 2020 at 7:24 AM Twingly Customer Support
>> <> wrote:
>>> Hi,
>>> We have a server running FreeBSD 12.1-RELEASE-p10. We currently have =
>>> problem where FreeBSD starting to swap when running ZFS scrub, even
>>> though we have ~70G of free memory.
>> tl;dr =E2=80=93 this is normal, nothing to see, move along.
> 	Not when it starts running out of swap space while still =
> 70G of free memory.

I encountered this issue a year or so ago.  In my case it turned out to =
be a process that was allocating anonymous segments using mmap.  It =
tended to forget to free them after the usage was complete.  As a =
result, the system would run out of swap even though there was plenty of =
free memory.  Anonymous segments are mapped to swap space.  I traced the =
problem using:

	procstat -va | grep df

That generated a lot of data.  I looked for processes that had an =
increasing number of df files.  Eventually I found the right one and =
fixed it.

Interesting observation:  I have used FreeBSD since version 2.5 and for =
years it always had a small number of processes swapped out within an =
hour of a boot.  Typically they were gettys and similar processes that =
never got used.  However, with 12.x, I now find that swap info is always =
showing 0 blocks used even after weeks of operation.  Something has =
changed for the better.

It is also possible that greping for sw rather than df might give some =
useful information.  I can't tell as none of my systems are using any =
swap.  Actually, one system did not have any swap for over a year.  I =
didn't notice that there was an issue mounting its swap.  There were no =
performance indicators that issue existed.  Nothing changed after I =
corrected the problem and added the swap.

-- Doug

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