From nobody Wed Dec 27 20:26:28 2023 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0jpp4pJ2z56GTs for ; Wed, 27 Dec 2023 20:26:42 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (tunnel82308-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) (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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "garrett.wollman.name", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0jpm63Wgz4SPm for ; Wed, 27 Dec 2023 20:26:40 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of wollman@hergotha.csail.mit.edu designates 2001:470:1f06:ccb::2 as permitted sender) smtp.mailfrom=wollman@hergotha.csail.mit.edu; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bimajority.org (policy=none) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.17.1/8.17.1) with ESMTPS id 3BRKQTdl041213 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 27 Dec 2023 15:26:29 -0500 (EST) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.17.1/8.17.1/Submit) id 3BRKQSCq041212; Wed, 27 Dec 2023 15:26:28 -0500 (EST) (envelope-from wollman) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <25996.34932.339497.605798@hergotha.csail.mit.edu> Date: Wed, 27 Dec 2023 15:26:28 -0500 From: Garrett Wollman To: "Patrick M. Hausen" Cc: Yuri , FreeBSD-STABLE Mailing List Subject: Re: Odd values for various memory metrics via SNMP In-Reply-To: References: <1EDAF2AC-3A2B-43BE-B66B-E095F5A80C2C@punkt.de> <84B7C7D7-BC06-4944-A7E0-5AFC47B6BC0E@punkt.de> <8f4cf72e-8320-4bfd-a4d9-3db34db4580d@aetern.org> X-Mailer: VM 8.2.0b under 29.1 (amd64-portbld-freebsd13.2) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.4 (hergotha.csail.mit.edu [0.0.0.0]); Wed, 27 Dec 2023 15:26:29 -0500 (EST) X-Spam-Status: No, score=-4.5 required=5.0 tests=ALL_TRUSTED, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on hergotha.csail.mit.edu X-Spamd-Result: default: False [-2.90 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[wollman@bimajority.org,wollman@hergotha.csail.mit.edu]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:1f06:ccb::2]; DMARC_POLICY_SOFTFAIL(0.10)[bimajority.org : SPF not aligned (relaxed), No valid DKIM,none]; MIME_GOOD(-0.10)[text/plain]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; R_DKIM_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[freebsd-stable@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[wollman@bimajority.org,wollman@hergotha.csail.mit.edu]; ARC_NA(0.00)[]; TO_DN_ALL(0.00)[]; FREEFALL_USER(0.00)[wollman]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Queue-Id: 4T0jpm63Wgz4SPm X-Spamd-Bar: -- < said: > Now only "virtual memory" is left - according to the book that should be > the sum of physical memory and swap space - and for my single Linux > host it is. > For the FreeBSD systems this is the one left that still looks nonsensical. > OPNsense (8G RAM, 8G swap): 4.91 of 4.99G used. > TrueNAS (64G RAM, 32G swap): 627 of 628G used. > TrueNAS 2 (32G RAM, 32G swap): 512 of 516G used. This is computed by the function vmtotal() in sys/vm/vm_meter.c. It walks all VM objects in the system, skipping those that are unreferenced, and adds up all of their sizes. There is one VM object for every open file and every running executable, shared library, and mmap()ed region, plus one for every copy-on-write mapping for each process that has modified it, which includes the data segment of every executable and shared library. This has no connection to either physical memory or swap space. The "shared" statistics count only and exactly the underlying (read-only) mapping of objects that are mapped with copy-on-write semantics. -GAWollman