Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm Add a vm.uvmexp2 sysctl that uses a ABI-safe 'struct...
details: https://anonhg.NetBSD.org/src/rev/b486d33599d9
branches: trunk
changeset: 499784:b486d33599d9
user: simonb <simonb%NetBSD.org@localhost>
date: Wed Nov 29 09:52:18 2000 +0000
description:
Add a vm.uvmexp2 sysctl that uses a ABI-safe 'struct uvmexp_sysctl'.
diffstat:
sys/uvm/uvm_extern.h | 85 +++++++++++++++++++++++++++++++++++++++++++++++-
sys/uvm/uvm_meter.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++-
sys/uvm/uvm_param.h | 8 ++-
3 files changed, 179 insertions(+), 6 deletions(-)
diffs (257 lines):
diff -r 2e2169da9d01 -r b486d33599d9 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Wed Nov 29 09:25:22 2000 +0000
+++ b/sys/uvm/uvm_extern.h Wed Nov 29 09:52:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.53 2000/11/27 08:40:03 chs Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.54 2000/11/29 09:52:18 simonb Exp $ */
/*
*
@@ -251,6 +251,9 @@
int inactive; /* number of pages that we free'd but may want back */
int paging; /* number of pages in the process of being paged out */
int wired; /* number of wired pages */
+ /* XXX: Adding anything before this line will break binary
+ * compatibility with top(1) on NetBSD 1.5.
+ */
int zeropages; /* number of zero'd pages */
int reserve_pagedaemon; /* number of pages reserved for pagedaemon */
int reserve_kernel; /* number of pages reserved for kernel */
@@ -334,6 +337,86 @@
struct uvm_object *mb_object;
};
+/*
+ * The following structure is 64-bit alignment safe. New elements
+ * should only be added to the end of this structure so binary
+ * compatibility can be preserved.
+ */
+struct uvmexp_sysctl {
+ int64_t pagesize;
+ int64_t pagemask;
+ int64_t pageshift;
+ int64_t npages;
+ int64_t free;
+ int64_t active;
+ int64_t inactive;
+ int64_t paging;
+ int64_t wired;
+ int64_t zeropages;
+ int64_t reserve_pagedaemon;
+ int64_t reserve_kernel;
+ int64_t freemin;
+ int64_t freetarg;
+ int64_t inactarg;
+ int64_t wiredmax;
+ int64_t nswapdev;
+ int64_t swpages;
+ int64_t swpguniq;
+ int64_t swpginuse;
+ int64_t swpgonly;
+ int64_t nswget;
+ int64_t nanon;
+ int64_t nanonneeded;
+ int64_t nfreeanon;
+ int64_t faults;
+ int64_t traps;
+ int64_t intrs;
+ int64_t swtch;
+ int64_t softs;
+ int64_t syscalls;
+ int64_t pageins;
+ int64_t swapins;
+ int64_t swapouts;
+ int64_t pgswapin;
+ int64_t pgswapout;
+ int64_t forks;
+ int64_t forks_ppwait;
+ int64_t forks_sharevm;
+ int64_t pga_zerohit;
+ int64_t pga_zeromiss;
+ int64_t zeroaborts;
+ int64_t fltnoram;
+ int64_t fltnoanon;
+ int64_t fltpgwait;
+ int64_t fltpgrele;
+ int64_t fltrelck;
+ int64_t fltrelckok;
+ int64_t fltanget;
+ int64_t fltanretry;
+ int64_t fltamcopy;
+ int64_t fltnamap;
+ int64_t fltnomap;
+ int64_t fltlget;
+ int64_t fltget;
+ int64_t flt_anon;
+ int64_t flt_acow;
+ int64_t flt_obj;
+ int64_t flt_prcopy;
+ int64_t flt_przero;
+ int64_t pdwoke;
+ int64_t pdrevs;
+ int64_t pdswout;
+ int64_t pdfreed;
+ int64_t pdscans;
+ int64_t pdanscan;
+ int64_t pdobscan;
+ int64_t pdreact;
+ int64_t pdbusy;
+ int64_t pdpageouts;
+ int64_t pdpending;
+ int64_t pddeact;
+};
+
#ifdef _KERNEL
extern struct uvmexp uvmexp;
#endif
diff -r 2e2169da9d01 -r b486d33599d9 sys/uvm/uvm_meter.c
--- a/sys/uvm/uvm_meter.c Wed Nov 29 09:25:22 2000 +0000
+++ b/sys/uvm/uvm_meter.c Wed Nov 29 09:52:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_meter.c,v 1.14 2000/11/24 18:54:31 chs Exp $ */
+/* $NetBSD: uvm_meter.c,v 1.15 2000/11/29 09:52:19 simonb Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,6 +71,7 @@
static void uvm_loadav __P((struct loadavg *));
static void uvm_total __P((struct vmtotal *));
+static int sysctl_uvmexp __P((void *, size_t *));
/*
* uvm_meter: calculate load average and wake up the swapper (if needed)
@@ -145,8 +146,12 @@
sizeof(vmtotals)));
case VM_UVMEXP:
- return (sysctl_rdstruct(oldp, oldlenp, newp, &uvmexp,
+ return (sysctl_rdminstruct(oldp, oldlenp, newp, &uvmexp,
sizeof(uvmexp)));
+ case VM_UVMEXP2:
+ if (newp)
+ return (EPERM);
+ return (sysctl_uvmexp(oldp, oldlenp));
case VM_NKMEMPAGES:
return (sysctl_rdint(oldp, oldlenp, newp, nkmempages));
@@ -157,6 +162,89 @@
/* NOTREACHED */
}
+static int
+sysctl_uvmexp(oldp, oldlenp)
+ void *oldp;
+ size_t *oldlenp;
+{
+ struct uvmexp_sysctl u;
+
+ u.pagesize = uvmexp.pagesize;
+ u.pagemask = uvmexp.pagemask;
+ u.pageshift = uvmexp.pageshift;
+ u.npages = uvmexp.npages;
+ u.free = uvmexp.free;
+ u.active = uvmexp.active;
+ u.inactive = uvmexp.inactive;
+ u.paging = uvmexp.paging;
+ u.wired = uvmexp.wired;
+ u.zeropages = uvmexp.zeropages;
+ u.reserve_pagedaemon = uvmexp.reserve_pagedaemon;
+ u.reserve_kernel = uvmexp.reserve_kernel;
+ u.freemin = uvmexp.freemin;
+ u.freetarg = uvmexp.freetarg;
+ u.inactarg = uvmexp.inactarg;
+ u.wiredmax = uvmexp.wiredmax;
+ u.nswapdev = uvmexp.nswapdev;
+ u.swpages = uvmexp.swpages;
+ u.swpguniq = uvmexp.swpguniq;
+ u.swpginuse = uvmexp.swpginuse;
+ u.swpgonly = uvmexp.swpgonly;
+ u.nswget = uvmexp.nswget;
+ u.nanon = uvmexp.nanon;
+ u.nanonneeded = uvmexp.nanonneeded;
+ u.nfreeanon = uvmexp.nfreeanon;
+ u.faults = uvmexp.faults;
+ u.traps = uvmexp.traps;
+ u.intrs = uvmexp.intrs;
+ u.swtch = uvmexp.swtch;
+ u.softs = uvmexp.softs;
+ u.syscalls = uvmexp.syscalls;
+ u.pageins = uvmexp.pageins;
+ u.swapins = uvmexp.swapins;
+ u.swapouts = uvmexp.swapouts;
+ u.pgswapin = uvmexp.pgswapin;
+ u.pgswapout = uvmexp.pgswapout;
+ u.forks = uvmexp.forks;
+ u.forks_ppwait = uvmexp.forks_ppwait;
+ u.forks_sharevm = uvmexp.forks_sharevm;
+ u.pga_zerohit = uvmexp.pga_zerohit;
+ u.pga_zeromiss = uvmexp.pga_zeromiss;
+ u.zeroaborts = uvmexp.zeroaborts;
+ u.fltnoram = uvmexp.fltnoram;
+ u.fltnoanon = uvmexp.fltnoanon;
+ u.fltpgwait = uvmexp.fltpgwait;
+ u.fltpgrele = uvmexp.fltpgrele;
+ u.fltrelck = uvmexp.fltrelck;
+ u.fltrelckok = uvmexp.fltrelckok;
+ u.fltanget = uvmexp.fltanget;
+ u.fltanretry = uvmexp.fltanretry;
+ u.fltamcopy = uvmexp.fltamcopy;
+ u.fltnamap = uvmexp.fltnamap;
+ u.fltnomap = uvmexp.fltnomap;
+ u.fltlget = uvmexp.fltlget;
+ u.fltget = uvmexp.fltget;
+ u.flt_anon = uvmexp.flt_anon;
+ u.flt_acow = uvmexp.flt_acow;
+ u.flt_obj = uvmexp.flt_obj;
+ u.flt_prcopy = uvmexp.flt_prcopy;
+ u.flt_przero = uvmexp.flt_przero;
+ u.pdwoke = uvmexp.pdwoke;
+ u.pdrevs = uvmexp.pdrevs;
+ u.pdswout = uvmexp.pdswout;
+ u.pdfreed = uvmexp.pdfreed;
+ u.pdscans = uvmexp.pdscans;
+ u.pdanscan = uvmexp.pdanscan;
+ u.pdobscan = uvmexp.pdobscan;
+ u.pdreact = uvmexp.pdreact;
+ u.pdbusy = uvmexp.pdbusy;
+ u.pdpageouts = uvmexp.pdpageouts;
+ u.pdpending = uvmexp.pdpending;
+ u.pddeact = uvmexp.pddeact;
+
+ return (sysctl_rdminstruct(oldp, oldlenp, NULL, &u, sizeof(u)));
+}
+
/*
* uvm_total: calculate the current state of the system.
*/
diff -r 2e2169da9d01 -r b486d33599d9 sys/uvm/uvm_param.h
--- a/sys/uvm/uvm_param.h Wed Nov 29 09:25:22 2000 +0000
+++ b/sys/uvm/uvm_param.h Wed Nov 29 09:52:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_param.h,v 1.1 2000/06/26 14:59:04 mrg Exp $ */
+/* $NetBSD: uvm_param.h,v 1.2 2000/11/29 09:52:19 simonb Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -106,9 +106,10 @@
*/
#define VM_METER 1 /* struct vmmeter */
#define VM_LOADAVG 2 /* struct loadavg */
-#define VM_UVMEXP 3 /* struct uvmexp */
+#define VM_UVMEXP 3 /* struct uvmexp */
#define VM_NKMEMPAGES 4 /* kmem_map pages */
-#define VM_MAXID 5 /* number of valid vm ids */
+#define VM_UVMEXP2 5 /* struct uvmexp_sysctl */
+#define VM_MAXID 6 /* number of valid vm ids */
#define CTL_VM_NAMES { \
{ 0, 0 }, \
@@ -116,6 +117,7 @@
{ "loadavg", CTLTYPE_STRUCT }, \
{ "uvmexp", CTLTYPE_STRUCT }, \
{ "nkmempages", CTLTYPE_INT }, \
+ { "uvmexp2", CTLTYPE_STRUCT }, \
}
Home |
Main Index |
Thread Index |
Old Index