From nobody Wed Feb 09 00:43:33 2022 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 7B28819B1751; Wed, 9 Feb 2022 00:43:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jth2F2xrJz4pxD; Wed, 9 Feb 2022 00:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644367413; 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=X440slDtQIc2ogcNNfJt5QEW2Btkj+pEMiI5M62f06w=; b=JZOkXWV2S6+wZDOYtRnJGSgrTcJV/YFW5U78Jy9+bLoU+blF5cGKU0pHt0ScBQzVTOhuaa U2Ji0QlnoNQ6wszVyXhObxkjkCSYtoqjgeBdxqfoVB2YtAHxLQVexVbH4O1QsCJ6O11qI0 NlitGcWlNll273KDeZUG1AHU5Y14ihhoMLsM6pNb672IbTukpjATP7KemeWs4tx6px+UWQ TIBLQ4RxzUHkzlWXa9YtMddM/nB87P2Fl/F4MuA4LxRTmC+bTJB3JRs6YlBvq9REe9f4pi ZIjQhisgkU6ONwA/c6D89gAcIUXeGrqvlLayol36F4dImC5JTrFSRwLPFrVNow== 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 46A33239FA; Wed, 9 Feb 2022 00:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2190hXPl083050; Wed, 9 Feb 2022 00:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2190hXnJ083049; Wed, 9 Feb 2022 00:43:33 GMT (envelope-from git) Date: Wed, 9 Feb 2022 00:43:33 GMT Message-Id: <202202090043.2190hXnJ083049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6d95a66f1b53 - stable/13 - vm_object: Make is_object_active() global 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6d95a66f1b538996f6c43710ce1fde903928d85f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644367413; 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=X440slDtQIc2ogcNNfJt5QEW2Btkj+pEMiI5M62f06w=; b=aGtMI2JjxHioxtfEvcic/eoR15zGbq8NRI6aWlkgM1UjPR+u4qGYHyxfwMnlxzbutTTZ1M iv2qyl+SAdBIqzJZUlEU0vfQxdWhzp/pcuEf3ciotm15vRFxt6uB8ZsXNeEiYR8udPDImU +YRQtHke0Qa4GVOFnFZ0PNMOF/6mejnxwy9dX2c0EpJmUI0HZh5xmxMVF30og5c2bOjXfG +bcgYmixyP9DVW7y9rVPTMXBfv2+GtNv7OB0qYwvAUZ+8ETbytmriK4HVUNOAjDfw8dVr/ xa+LGlq3RjxAZasMWsEBH/xaBNt4f1xLh+phpB4u6mRqvcu1iBti86dXZv3m+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644367413; a=rsa-sha256; cv=none; b=dPfOhTQozt9yN0TIfo8PiEFEGU5jEhdSfyeFbwkLam6X1b6CDCuJ2KUxcN+QyDVSGdS3mp XvuF5XAAXXaeQ2WwhYWzz+dti8fTaL/fxyyxO9WXFSoJvFlWmIH8qr8Vv5uA6dbcrsbuF0 keLGMiy6oImEcNmy+CdGzaa9gP+JRoFfd/VuRvD+41rwpqOkf9tRfsZxVgk0pHgZALCsgV 4Yz2Ftj100eZMBzdayuz4H9uASGCmad65BLl16+IrS5UWqL0QRHYjA2o714U9MkufrPkDp utcXEeWiPMq1TIJSpCGLPumVbJBIocK/Xt4qFmdQfVL2JAwysqUdPxfiBZZ/qA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6d95a66f1b538996f6c43710ce1fde903928d85f commit 6d95a66f1b538996f6c43710ce1fde903928d85f Author: Rick Macklem AuthorDate: 2021-12-20 00:11:44 +0000 Commit: Konstantin Belousov CommitDate: 2022-02-09 00:42:44 +0000 vm_object: Make is_object_active() global (cherry picked from commit cd37afd8b6ddc38fe2441e37a8bf5f8cdce50bc6) --- sys/vm/vm_meter.c | 19 ++----------------- sys/vm/vm_object.c | 15 +++++++++++++++ sys/vm/vm_object.h | 1 + 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 44d3ac999c5a..15afd1f23649 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -142,21 +142,6 @@ SYSCTL_PROC(_vm, VM_LOADAVG, loadavg, CTLTYPE_STRUCT | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_loadavg, "S,loadavg", "Machine loadaverage history"); -/* - * This function aims to determine if the object is mapped, - * specifically, if it is referenced by a vm_map_entry. Because - * objects occasionally acquire transient references that do not - * represent a mapping, the method used here is inexact. However, it - * has very low overhead and is good enough for the advisory - * vm.vmtotal sysctl. - */ -static bool -is_object_active(vm_object_t obj) -{ - - return (obj->ref_count > obj->shadow_count); -} - #if defined(COMPAT_FREEBSD11) struct vmtotal11 { int16_t t_rq; @@ -268,7 +253,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) } total.t_vm += object->size; total.t_rm += object->resident_page_count; - if (is_object_active(object)) { + if (vm_object_is_active(object)) { total.t_avm += object->size; total.t_arm += object->resident_page_count; } @@ -276,7 +261,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) /* shared object */ total.t_vmshr += object->size; total.t_rmshr += object->resident_page_count; - if (is_object_active(object)) { + if (vm_object_is_active(object)) { total.t_avmshr += object->size; total.t_armshr += object->resident_page_count; } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index cc4463567aae..7bc503f7afdf 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -2498,6 +2498,21 @@ vm_object_busy_wait(vm_object_t obj, const char *wmesg) (void)blockcount_sleep(&obj->busy, NULL, wmesg, PVM); } +/* + * This function aims to determine if the object is mapped, + * specifically, if it is referenced by a vm_map_entry. Because + * objects occasionally acquire transient references that do not + * represent a mapping, the method used here is inexact. However, it + * has very low overhead and is good enough for the advisory + * vm.vmtotal sysctl. + */ +bool +vm_object_is_active(vm_object_t obj) +{ + + return (obj->ref_count > obj->shadow_count); +} + static int vm_object_list_handler(struct sysctl_req *req, bool swap_only) { diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index 2a16d8c6f096..903c85261254 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -391,6 +391,7 @@ boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t, void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t length, uint8_t queue); struct vnode *vm_object_vnode(vm_object_t object); +bool vm_object_is_active(vm_object_t obj); #endif /* _KERNEL */ #endif /* _VM_OBJECT_ */