Can pages counted in kvo->kvo_wired also be counted in one of kvo->kvo_active vs. vo->kvo_inactive?
Date: Tue, 14 Oct 2025 19:53:59 UTC
I note that in the below code the vm_page_wired(m)
case is not handled as if mutual exclusion of the
counts is automatic. But I assume that something
counted in kvo->kvo_laundry would not be counted
in kvo->kvo_wired as well. kvo_inactive and
kvo_active seem less obvious.
I figured double counting might happen, otherwise
various evaluations of vm_page_wired(m) could have
been avoided in the below.
if (!swap_only) {
vm_page_iter_init(&pages, obj);
VM_RADIX_FOREACH(m, &pages) {
/*
* 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 (vm_page_active(m))
kvo->kvo_active++;
else if (vm_page_inactive(m))
kvo->kvo_inactive++;
else if (vm_page_in_laundry(m))
kvo->kvo_laundry++;
if (vm_page_wired(m))
kvo->kvo_wired++;
}
}
Part of the reason that I ask is that I've historically assumed
that Active+Inact+Laundry+Wired did not do any double/multiple
counting. So I assumed that there was no indication of Active
vs. Inact status for Wired.
If Active+Inact+Laundry+Wired can double/multiple count, I'd
like to know that for understanding how to interpret such
figures.
===
Mark Millard
marklmi at yahoo.com