Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 2020 14:16:08 +0100
From:      Steve O'Hara-Smith <steve@sohara.org>
To:        Odhiambo Washington <odhiambo@gmail.com>
Cc:        questions <questions@freebsd.org>
Subject:   Re: Swapping when memory is idle??
Message-ID:  <20200820141608.a8bb35f9dd089d9bc190253b@sohara.org>
In-Reply-To: <CAAdA2WP8cr-uRgDRT_GX0faCSAFWORn9UMwqLZOWtLgXd0Hc9w@mail.gmail.com>
References:  <CAAdA2WP8cr-uRgDRT_GX0faCSAFWORn9UMwqLZOWtLgXd0Hc9w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 20 Aug 2020 10:53:27 +0300
Odhiambo Washington <odhiambo@gmail.com> wrote:

> I have a machine with 16GB RAM and not heavily used.
> I see from `top` some things that I do not understand well.
> Why would a system use swap when memory is idle?

	The system will push pages out to swap in response to memory
pressure, trying to choose the pages least likely to be used soon. Once the
memory pressure recovers there will be free memory again - and the pressure
may only last a tiny amount of time. However once a page is pushed out to
swap it will stay there until something tries to use it - many processes
have quite a lot of memory that is only touched during initialisation and
that is a prime candidate for being swapped out ... of course it tends to
stay that way.

	This is of course a good thing because it clears memory of useless
cruft so next time there's a bit of memory pressure maybe nothing has to be
swapped out.

-- 
Steve O'Hara-Smith <steve@sohara.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200820141608.a8bb35f9dd089d9bc190253b>