From owner-freebsd-questions@freebsd.org Fri Aug 21 07:56:14 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 D37F93B69F0 for ; Fri, 21 Aug 2020 07:56:14 +0000 (UTC) (envelope-from odhiambo@gmail.com) Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXv3K39v4z4b1B for ; Fri, 21 Aug 2020 07:56:13 +0000 (UTC) (envelope-from odhiambo@gmail.com) Received: by mail-ot1-x342.google.com with SMTP id h22so917599otq.11 for ; Fri, 21 Aug 2020 00:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=02cnbHsKmvkaNZet083YGAUub2t9sY+eG2k5c3EiPO0=; b=pB7igynxBiKGUQA7Gc8LGe1we1HExJfyiBMe3gpz5tJ4i+sUMnO9hQbmrnD4uRxvAx vQR2o8m8sggejWf2qmlOpr9JZPSOj7a6GMV1qvlEpFn8KaxE4wVXUbWONawfuPtnzS9B yyr+8JrfNQwPdNpP37nEL5Vqklpu7E/AI+Xn8IW1jgSDoZ8aD/Sk6tdApaw+ry+NLdIr KYoBCytPdz4NrpW9N+U4ygPs2yco7jZrFQMvsP+AGxhpcHGYOZ16U85LE/oz2JW1Nga+ XoKBFOd4LtIHYLTr6+r1CapfHrqgUgOaeJEvCrBBru+AsKjj0S3WCAOoG/pAJ6FfjIAl 5YRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=02cnbHsKmvkaNZet083YGAUub2t9sY+eG2k5c3EiPO0=; b=dY7iHxXe5JXtidq4oJeMcZ30+7kEt6H3f569RgIfyekSgn+sXUlG07PHmAb9PYh7Hb Cil3SmYHbtBJSizIJ0jQ6CuaVHGI8LddWud6k02yizES9SB+Iyz8r1Y+UdCIXjoiNLxN SArpitkd/XMDPFjYD3U6VI7CJiUNsxh9onqo9mwmO5VtjlLJYaD3YT8wLJGb85Rw4ix2 ydZf59Rd32bTeVayiMxSPvWY0C0FURIGtwIR0Z5K2SDCLRBZumhacsrmrsKc25BTsBTO 5Td2kv2gcqBm1tiXd/2K2yDHo7CIWLmg3t6JhaCT+mOiP7nFEq6ftGBYiB1+yzH5wARG rHYg== X-Gm-Message-State: AOAM530UUlDIkdphJIOf0Tk4mapNSIEnSXPna4yKvGL6YDLa4E0z2ObV MecmkMyxG7xJ8zaB1Z8BqDKbQJMzTJ5EzcT0aBvpATiANqA= X-Google-Smtp-Source: ABdhPJw2J22KLsN5ZlNYotvCsORJLUrCRT8DKPn7KSPHcLh+iQFDPmROI1rjN/iwFdjZ3dzc29HlLjcm33oIZnrJifM= X-Received: by 2002:a05:6830:1286:: with SMTP id z6mr1092071otp.240.1597996572156; Fri, 21 Aug 2020 00:56:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Odhiambo Washington Date: Fri, 21 Aug 2020 10:55:42 +0300 Message-ID: Subject: Re: Swapping when memory is idle?? To: "@lbutlr" Cc: FreeBSD X-Rspamd-Queue-Id: 4BXv3K39v4z4b1B X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=pB7igynx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of odhiambo@gmail.com designates 2607:f8b0:4864:20::342 as permitted sender) smtp.mailfrom=odhiambo@gmail.com X-Spamd-Result: default: False [-0.92 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.984]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; NEURAL_SPAM_SHORT(0.06)[0.063]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::342:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; MAILMAN_DEST(0.00)[freebsd-questions]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 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: Fri, 21 Aug 2020 07:56:14 -0000 On Thu, 20 Aug 2020 at 21:40, @lbutlr wrote: > 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. > After this great explanation, it turns out that what I was seeing is actually a good thing! My limited reasoning was that a system should always use swap when it runs out of memory. And this stupid line of thought has been in my mind since forever!!! :-) Thank you very much for the explanation. -- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)