vm.objects_swap: disable reporting some information

For making the call faster, do not count active/inactive object queues,
and do not report vnode info if any (for tmpfs).

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31163
This commit is contained in:
Konstantin Belousov 2021-07-13 13:34:31 +03:00
parent 42812ccc96
commit 7738118e9a

View file

@ -2526,20 +2526,22 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
kvo->kvo_memattr = obj->memattr;
kvo->kvo_active = 0;
kvo->kvo_inactive = 0;
TAILQ_FOREACH(m, &obj->memq, listq) {
/*
* A page may belong to the object but be
* dequeued and set to PQ_NONE while the
* object lock is not held. This makes the
* reads of m->queue below racy, and we do not
* count pages set to PQ_NONE. However, this
* sysctl is only meant to give an
* approximation of the system anyway.
*/
if (m->a.queue == PQ_ACTIVE)
kvo->kvo_active++;
else if (m->a.queue == PQ_INACTIVE)
kvo->kvo_inactive++;
if (!swap_only) {
TAILQ_FOREACH(m, &obj->memq, listq) {
/*
* A page may belong to the object but be
* dequeued and set to PQ_NONE while the
* object lock is not held. This makes the
* reads of m->queue below racy, and we do not
* count pages set to PQ_NONE. However, this
* sysctl is only meant to give an
* approximation of the system anyway.
*/
if (m->a.queue == PQ_ACTIVE)
kvo->kvo_active++;
else if (m->a.queue == PQ_INACTIVE)
kvo->kvo_inactive++;
}
}
kvo->kvo_vn_fileid = 0;
@ -2547,7 +2549,8 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
kvo->kvo_vn_fsid_freebsd11 = 0;
freepath = NULL;
fullpath = "";
kvo->kvo_type = vm_object_kvme_type(obj, &vp);
vp = NULL;
kvo->kvo_type = vm_object_kvme_type(obj, swap_only ? NULL : &vp);
if (vp != NULL) {
vref(vp);
} else if ((obj->flags & OBJ_ANON) != 0) {