From nobody Tue Oct 29 13:34:18 2024 X-Original-To: dev-commits-src-all@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 4XdB7H0bZWz5bTBm; Tue, 29 Oct 2024 13:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XdB7G3jNPz4DF9; Tue, 29 Oct 2024 13:34:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730208858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BmaH/0OF0+HNHRlBMDGuejU9sy8Uo1tAYErquEb/lpA=; b=YUIThd0vxklaaDdoU93ueXCv9O+JbzQ8Ew2SVqILYVijV2gU6/V98RspYStatx6YLxm2mW ioUgauDLLNpdpNRSmGFbN0SPLfBI2fJ53SzlmCyFQee3u+gv/G6IkmbEmuUoHRbeDIJp93 RyBxPM7iCtfdOF/HQbcOh86QjHHVBZC8JEaXlnq3M9wNIQP1phcRctQkz1rY3oIkOicViD E/GKH3firBGxmjT6aneY+3jRrNohs8APY5tsmBN8d+SMbiUx8MgbSPSh1ebgv0gxsZ1HR7 vPQ/3BG8641wRV8R50l/+C/XyNwNng9wA46qEdofNRg066FrdzbSAsI/TJNRjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730208858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BmaH/0OF0+HNHRlBMDGuejU9sy8Uo1tAYErquEb/lpA=; b=DAT7Iq4AK6UBbUGrJICYlUlp4Z85LDcZ6RWsum6DGApmvVR/IfWtUBEzqArRNqQS3Qv6PF PgVh6BKsl95iOWEyoOsufrFpKlojMYtLUjiVtQCmPUY9LasXruacwoqAEHSAgga179n83J MOwsrJqa7+WyODTal+2rfqIn8kYS6+P4MCTRFFgcpDIioddeCF0x9+c69ALeIg8J+18Wv2 j8xXZPP+rbS6oGfRenV/JkD5n0RZa93Cu8n4L7KduLlhLoOUIksWzUhA1TpOgDA5387wuB 9oqsyY4s0N00WPkBSPLVl94WoG3QWvqfGts5ow2mVPMqx+UWuQ3Au1mn3zBG6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730208858; a=rsa-sha256; cv=none; b=aby/B29OrsvM+hVbqoN/biW+2vBeym8JjJLLK9zHuYDwzevF9PzbiwyjHAdn+R2SLLkcbs zpVUQIwXwSDGxLxC/IXjsUi6UqmKG0MuyXkDvQ4VCfnh4Me8V01t7lpmtm7RVuiI4JL3YA RoZlVVIRdZHmgVl9WX92DBDv1iHXaQZ1vRWvopxsX0Gf2G/ML4Ty8+zNvZq1kgGh3gUPQl Q/yrEoXIWjzvbAmtjS3wcugfgcEZWTPCEPwx6P/3LjYP7bd1tUz1otbI2Hvsr3UH9t0dDu wTJP7ZpmY8fjlGxRE3jLeMu9qLvnXd7FpK27+pR+SBz2OJU3vq1A6fSG3gcCig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XdB7G3FhgzQWg; Tue, 29 Oct 2024 13:34:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49TDYI7n035816; Tue, 29 Oct 2024 13:34:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49TDYICb035813; Tue, 29 Oct 2024 13:34:18 GMT (envelope-from git) Date: Tue, 29 Oct 2024 13:34:18 GMT Message-Id: <202410291334.49TDYICb035813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1d271ba05fce - stable/14 - vm_meter: Fix laundry accounting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1d271ba05fceb1ef6246e8079bc19e3b6416a833 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1d271ba05fceb1ef6246e8079bc19e3b6416a833 commit 1d271ba05fceb1ef6246e8079bc19e3b6416a833 Author: Mark Johnston AuthorDate: 2024-10-22 12:48:43 +0000 Commit: Mark Johnston CommitDate: 2024-10-29 13:04:25 +0000 vm_meter: Fix laundry accounting Pages in PQ_UNSWAPPABLE should be considered part of the laundry. Otherwise, on systems with no swap, the total amount of memory visible to tools like top(1) decreases. It doesn't seem very useful to have a dedicated counter for unswappable pages, and updating applications accordingly would be painful, so just lump them in with laundry for now. PR: 280846 Reviewed by: bnovkov, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47216 (cherry picked from commit 6a07e67fb7a8b5687a492d9d70a10651d5933ff5) --- sys/vm/vm_meter.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index aaea39486baa..75395f69c1db 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -458,7 +458,8 @@ u_int vm_laundry_count(void) { - return (vm_pagequeue_count(PQ_LAUNDRY)); + return (vm_pagequeue_count(PQ_LAUNDRY) + + vm_pagequeue_count(PQ_UNSWAPPABLE)); } static int @@ -480,6 +481,18 @@ SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdpages, CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_vm_pdpages, "QU", "Pages analyzed by pagedaemon"); +static int +sysctl_vm_laundry_pages(SYSCTL_HANDLER_ARGS) +{ + struct vm_domain *vmd; + u_int ret; + + vmd = arg1; + ret = vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt + + vmd->vmd_pagequeues[PQ_UNSWAPPABLE].pq_cnt; + return (SYSCTL_OUT(req, &ret, sizeof(ret))); +} + static void vm_domain_stats_init(struct vm_domain *vmd, struct sysctl_oid *parent) { @@ -506,8 +519,9 @@ vm_domain_stats_init(struct vm_domain *vmd, struct sysctl_oid *parent) "inactpdpgs", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_pdpages, 0, "Inactive pages scanned by the page daemon"); - SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, - "laundry", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt, 0, + SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "laundry", CTLFLAG_RD | CTLTYPE_UINT, vmd, 0, + sysctl_vm_laundry_pages, "IU", "laundry pages"); SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "laundpdpgs", CTLFLAG_RD,