From owner-freebsd-questions@freebsd.org Thu Aug 20 18:40:35 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 327EF3C55F3 for ; Thu, 20 Aug 2020 18:40:35 +0000 (UTC) (envelope-from kremels@kreme.com) Received: from mail.covisp.net (mail.covisp.net [65.121.55.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXYPF66m1z3YTM for ; Thu, 20 Aug 2020 18:40:33 +0000 (UTC) (envelope-from kremels@kreme.com) Content-Type: text/plain; charset=us-ascii Subject: Re: Swapping when memory is idle?? From: "@lbutlr" In-Reply-To: Date: Thu, 20 Aug 2020 12:40:32 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: FreeBSD X-Mailer: Apple Mail (2.3652.0.5.2.1) X-Rspamd-Queue-Id: 4BXYPF66m1z3YTM X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of kremels@kreme.com designates 65.121.55.42 as permitted sender) smtp.mailfrom=kremels@kreme.com X-Spamd-Result: default: False [1.79 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.37)[-0.366]; FROM_HAS_DN(0.00)[]; MISSING_MIME_VERSION(2.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+mx]; DMARC_NA(0.00)[kreme.com]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.44)[-0.443]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:65.112.0.0/12, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; MAILMAN_DEST(0.00)[freebsd-questions]; RCVD_IN_DNSWL_LOW(-0.10)[65.121.55.42:from] 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: Thu, 20 Aug 2020 18:40:35 -0000 On 20 Aug 2020, at 01:53, Odhiambo Washington = 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.