Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 2020 12:40:32 -0600
From:      "@lbutlr" <kremels@kreme.com>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: Swapping when memory is idle??
Message-ID:  <D2FB0F28-E822-48FF-BCEF-AC023831EDBE@kreme.com>
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 20 Aug 2020, at 01:53, 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?

Efficiency. Rather than reloading from static state disk libraries, you =
reload from swapped out RAM. This is faster as the swap maps right to =
the RAM and you are not reloading libraries and following depends.

An efficient system *may* use swap for any page that is not accessed for =
a certain period of time, trying to keep the system with as much memory =
as possible, or more usually a specific task will use a lot of memory, =
forcing pages to swap. This does not mean that memory was mixed out nor =
does it mean you need more RAM.

Once a page is in swap it will stay there until it is needed. So over =
the course of time, swap will tend to grow to some stable size, =
especially if you have a lot of rarely used services/libraries running.

If you have low uptime and high swap, that probably means something in =
your initial startup is using a lot of memory, but if the uptime is =
long, swap is probably going to grow.

And that is fine. You want you memory to be used.

I looks to me like your system is quite well used in terms of memory. =
There is 156M of free memory, but plenty of inactive and purgeable =
(laundry) which looks like a healthy system to me.

These are the important numbers, as long as the Free number is low, then =
high numbers in inac/laundry are what you want. If these are low and =
Free is also low, then your system is struggling.


--=20
I don't talk about problems, I disintegrate them.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D2FB0F28-E822-48FF-BCEF-AC023831EDBE>