From d196417615cee2b0bef878d8bece937836f17b1f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 15 Dec 2007 03:42:58 +0000 Subject: export kernel uvm_km_pages_free as vm.kmpagesfree; ok tedu, tested jsg --- sys/uvm/uvm_km.c | 5 +++-- sys/uvm/uvm_meter.c | 6 +++++- sys/uvm/uvm_param.h | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'sys') diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index 9f01d2ac560..002455a97df 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.65 2007/12/11 15:05:45 tedu Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.66 2007/12/15 03:42:57 deraadt Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -744,6 +744,8 @@ uvm_km_free_poolpage1(struct vm_map *map, vaddr_t addr) #endif /* __HAVE_PMAP_DIRECT */ } +int uvm_km_pages_free; /* number of pages currently on free list */ + #if defined(__HAVE_PMAP_DIRECT) /* * uvm_km_page allocator, __HAVE_PMAP_DIRECT arch @@ -785,7 +787,6 @@ uvm_km_putpage(void *v) struct mutex uvm_km_mtx; int uvm_km_pages_lowat; /* allocate more when reserve drops below this */ -int uvm_km_pages_free; /* number of pages currently on free list */ struct km_page { struct km_page *next; } *uvm_km_pages_head; diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c index 007921d85a2..80291539872 100644 --- a/sys/uvm/uvm_meter.c +++ b/sys/uvm/uvm_meter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_meter.c,v 1.23 2007/10/10 15:53:53 art Exp $ */ +/* $OpenBSD: uvm_meter.c,v 1.24 2007/12/15 03:42:57 deraadt Exp $ */ /* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */ /* @@ -137,6 +137,7 @@ uvm_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) struct vmtotal vmtotals; int rv, t; struct _ps_strings _ps = { PS_STRINGS }; + extern int uvm_km_pages_free; switch (name[0]) { case VM_SWAPENCRYPT: @@ -218,6 +219,9 @@ uvm_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) case VM_USPACE: return (sysctl_rdint(oldp, oldlenp, newp, USPACE)); + case VM_KMPAGESFREE: + return (sysctl_rdint(oldp, oldlenp, newp, uvm_km_pages_free)); + default: return (EOPNOTSUPP); } diff --git a/sys/uvm/uvm_param.h b/sys/uvm/uvm_param.h index 788539aea56..91e41bf2013 100644 --- a/sys/uvm/uvm_param.h +++ b/sys/uvm/uvm_param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_param.h,v 1.12 2007/03/26 08:43:34 art Exp $ */ +/* $OpenBSD: uvm_param.h,v 1.13 2007/12/15 03:42:57 deraadt Exp $ */ /* $NetBSD: uvm_param.h,v 1.5 2001/03/09 01:02:12 chs Exp $ */ /* @@ -112,7 +112,8 @@ typedef int boolean_t; #define VM_VNODEMIN 9 #define VM_MAXSLP 10 #define VM_USPACE 11 -#define VM_MAXID 12 /* number of valid vm ids */ +#define VM_KMPAGESFREE 12 +#define VM_MAXID 13 /* number of valid vm ids */ #define CTL_VM_NAMES { \ { 0, 0 }, \ @@ -127,6 +128,7 @@ typedef int boolean_t; { "vnodemin", CTLTYPE_INT }, \ { "maxslp", CTLTYPE_INT }, \ { "uspace", CTLTYPE_INT }, \ + { "kmpagesfree", CTLTYPE_INT }, \ } struct _ps_strings { -- cgit v1.2.3