Page MenuHomeFreeBSD

D21782.diff
No OneTemporary

D21782.diff

Index: head/sys/vm/vm_page.c
===================================================================
--- head/sys/vm/vm_page.c
+++ head/sys/vm/vm_page.c
@@ -73,11 +73,12 @@
#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_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 @@
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_page_aflag_clear(m, qflags & (PGA_REQUEUE |
PGA_REQUEUE_HEAD));
+ counter_u64_add(queue_ops, 1);
+ } else {
+ counter_u64_add(queue_nops, 1);
}
}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 19, 2:24 PM (11 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25642060
Default Alt Text
D21782.diff (1 KB)

Event Timeline