svn commit: r352690 - head/sys/vm
Mark Johnston
markj at FreeBSD.org
Wed Sep 25 17:08:36 UTC 2019
Author: markj
Date: Wed Sep 25 17:08:35 2019
New Revision: 352690
URL: https://svnweb.freebsd.org/changeset/base/352690
Log:
Add some counters for per-VM page events.
For now, just count batched page queue state operations.
vm.stats.page.queue_ops counts the number of batch entries that
successfully completed, while queue_nops counts entries that had no
effect, which occurs when the queue operation had been completed before
the batch entry was processed.
Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: Intel, Netflix
Differential Revision: https://reviews.freebsd.org/D21782
Modified:
head/sys/vm/vm_page.c
Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c Wed Sep 25 16:49:22 2019 (r352689)
+++ head/sys/vm/vm_page.c Wed Sep 25 17:08:35 2019 (r352690)
@@ -73,11 +73,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/lock.h>
+#include <sys/counter.h>
#include <sys/domainset.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/linker.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/msgbuf.h>
@@ -130,6 +131,28 @@ static int vm_min_waiters;
static int vm_severe_waiters;
static int vm_pageproc_waiters;
+static SYSCTL_NODE(_vm_stats, OID_AUTO, page, CTLFLAG_RD, 0,
+ "VM page statistics");
+
+static counter_u64_t queue_ops = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_ops,
+ CTLFLAG_RD, &queue_ops,
+ "Number of batched queue operations");
+
+static counter_u64_t queue_nops = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_nops,
+ CTLFLAG_RD, &queue_nops,
+ "Number of batched queue operations with no effects");
+
+static void
+counter_startup(void)
+{
+
+ queue_ops = counter_u64_alloc(M_WAITOK);
+ queue_nops = counter_u64_alloc(M_WAITOK);
+}
+SYSINIT(page_counters, SI_SUB_CPU, SI_ORDER_ANY, counter_startup, NULL);
+
/*
* bogus page -- for I/O to/from partially complete buffers,
* or for paging into sparsely invalid regions.
@@ -3117,6 +3140,7 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
if (__predict_true((qflags & PGA_ENQUEUED) != 0))
vm_pagequeue_remove(pq, m);
vm_page_dequeue_complete(m);
+ counter_u64_add(queue_ops, 1);
} else if ((qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) {
if ((qflags & PGA_ENQUEUED) != 0)
TAILQ_REMOVE(&pq->pq_pl, m, plinks.q);
@@ -3141,6 +3165,9 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
vm_page_aflag_clear(m, qflags & (PGA_REQUEUE |
PGA_REQUEUE_HEAD));
+ counter_u64_add(queue_ops, 1);
+ } else {
+ counter_u64_add(queue_nops, 1);
}
}
More information about the svn-src-head
mailing list