Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Oct 2025 12:53:59 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Mark Johnston <markj@FreeBSD.org>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Can pages counted in kvo->kvo_wired also be counted in one of  kvo->kvo_active vs. vo->kvo_inactive?
Message-ID:  <8F2B558A-7C48-43B1-B10D-F68D468BD5AB@yahoo.com>
References:  <8F2B558A-7C48-43B1-B10D-F68D468BD5AB.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8F2B558A-7C48-43B1-B10D-F68D468BD5AB>