diff options
-rw-r--r-- | sys/include/vm/obj.h | 2 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_obj.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/sys/include/vm/obj.h b/sys/include/vm/obj.h index e4258ac..6e24516 100644 --- a/sys/include/vm/obj.h +++ b/sys/include/vm/obj.h @@ -49,7 +49,7 @@ struct vm_object { #define vm_object_ref(OBJPTR) (++(OBJPTR)->ref) #define vm_object_unref(OBJPTR) do { \ - if ((OBJPTR)->ref > 1) { \ + if ((OBJPTR)->ref > 0) { \ --(OBJPTR)->ref; \ } \ } while (0); diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index afe6760..2501e08 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -305,12 +305,12 @@ munmap(void *addr, size_t len) spinlock_acquire(&obj->lock); /* * Drop our ref and try to cleanup. If the refcount - * is > 1, something is still holding it and we can't + * is > 0, something is still holding it and we can't * do much. */ vm_object_unref(obj); vp = obj->vnode; - if (vp != NULL && obj->ref == 1) { + if (vp != NULL && obj->ref == 0) { vp->vmobj = NULL; vm_obj_destroy(obj); } diff --git a/sys/vm/vm_obj.c b/sys/vm/vm_obj.c index 8f34ff3..6dbe777 100644 --- a/sys/vm/vm_obj.c +++ b/sys/vm/vm_obj.c @@ -61,7 +61,7 @@ vm_obj_init(struct vm_object **res, struct vnode *vnode) memset(obj, 0, sizeof(struct vm_object)); obj->vnode = vnode; - obj->ref = 1; + obj->ref = 0; vm_set_pgops(obj, vnode); *res = obj; |