summaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_obj.c10
-rw-r--r--sys/vm/vm_stat.c2
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/vm/vm_obj.c b/sys/vm/vm_obj.c
index 7487b47..8f34ff3 100644
--- a/sys/vm/vm_obj.c
+++ b/sys/vm/vm_obj.c
@@ -32,6 +32,8 @@
#include <sys/errno.h>
#include <string.h>
+static size_t obj_count = 0;
+
static void
vm_set_pgops(struct vm_object *obj, struct vnode *vnode)
{
@@ -63,6 +65,7 @@ vm_obj_init(struct vm_object **res, struct vnode *vnode)
vm_set_pgops(obj, vnode);
*res = obj;
+ ++obj_count;
return 0;
}
@@ -79,5 +82,12 @@ vm_obj_destroy(struct vm_object *obj)
return -EBUSY;
dynfree(obj);
+ --obj_count;
return 0;
}
+
+size_t
+vm_obj_count(void)
+{
+ return obj_count;
+}
diff --git a/sys/vm/vm_stat.c b/sys/vm/vm_stat.c
index 99ee9a9..6374699 100644
--- a/sys/vm/vm_stat.c
+++ b/sys/vm/vm_stat.c
@@ -29,6 +29,7 @@
#include <vm/physseg.h>
#include <vm/vm.h>
+#include <vm/obj.h>
struct vm_memstat
vm_memstat(void)
@@ -36,5 +37,6 @@ vm_memstat(void)
struct vm_memstat stat;
stat.pmem_stat = vm_phys_memstat();
+ stat.vmobj_cnt = vm_obj_count();
return stat;
}