svn commit: r286390 - head/sys/vm
Alan Cox
alc at FreeBSD.org
Thu Aug 6 21:27:52 UTC 2015
Author: alc
Date: Thu Aug 6 21:27:50 2015
New Revision: 286390
URL: https://svnweb.freebsd.org/changeset/base/286390
Log:
Introduce a sysctl for reporting the number of fully populated reservations.
Modified:
head/sys/vm/vm_reserv.c
Modified: head/sys/vm/vm_reserv.c
==============================================================================
--- head/sys/vm/vm_reserv.c Thu Aug 6 20:59:03 2015 (r286389)
+++ head/sys/vm/vm_reserv.c Thu Aug 6 21:27:50 2015 (r286390)
@@ -217,6 +217,11 @@ static long vm_reserv_freed;
SYSCTL_LONG(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD,
&vm_reserv_freed, 0, "Cumulative number of freed reservations");
+static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS);
+
+SYSCTL_PROC(_vm_reserv, OID_AUTO, fullpop, CTLTYPE_INT | CTLFLAG_RD, NULL, 0,
+ sysctl_vm_reserv_fullpop, "I", "Current number of full reservations");
+
static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS);
SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0,
@@ -235,6 +240,33 @@ static void vm_reserv_populate(vm_reser
static void vm_reserv_reclaim(vm_reserv_t rv);
/*
+ * Returns the current number of full reservations.
+ *
+ * Since the number of full reservations is computed without acquiring the
+ * free page queue lock, the returned value may be inexact.
+ */
+static int
+sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS)
+{
+ vm_paddr_t paddr;
+ struct vm_phys_seg *seg;
+ vm_reserv_t rv;
+ int fullpop, segind;
+
+ fullpop = 0;
+ for (segind = 0; segind < vm_phys_nsegs; segind++) {
+ seg = &vm_phys_segs[segind];
+ paddr = roundup2(seg->start, VM_LEVEL_0_SIZE);
+ while (paddr + VM_LEVEL_0_SIZE <= seg->end) {
+ rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT];
+ fullpop += rv->popcnt == VM_LEVEL_0_NPAGES;
+ paddr += VM_LEVEL_0_SIZE;
+ }
+ }
+ return (sysctl_handle_int(oidp, &fullpop, 0, req));
+}
+
+/*
* Describes the current state of the partially-populated reservation queue.
*/
static int
More information about the svn-src-head
mailing list