In-Reply-To: <8F2B558A-7C48-43B1-B10D-F68D468BD5AB@yahoo.com> References: <8F2B558A-7C48-43B1-B10D-F68D468BD5AB.ref@yahoo.com> <8F2B558A-7C48-43B1-B10D-F68D468BD5AB@yahoo.com>
| previous in thread | raw e-mail | index | archive | help
On Tue, Oct 14, 2025 at 12:53:59PM -0700, Mark Millard wrote: > 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. There is nothing special about the laundry queue vs. the active and inactive queues in this respect. Or in general really, it's just another queue. It is possible for a wired page to be present in one of the queues. Historically, pages were removed from their queue at the time they are wired. In some workloads pages were frequently wired for short periods, and so were moving in and out of the queues a lot. Since queue lock contention was already a problem at the time (less so now), we changed the wiring mechanism such that pages are dequeued lazily, once they are encountered by a page daemon thread during a queue scan. > 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. Indeed, it is possible for a page to be double-counted there. In general I would expect the number of queued, wired pages to be small enough that the double-counting is not significant. Whether or not that's the case depends a lot on the workload. > 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?>