summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_object.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2013-03-09 02:05:29 +0000
committerattilio <attilio@FreeBSD.org>2013-03-09 02:05:29 +0000
commit754f3790b85afd6cd15e69b91ee97848364f75f5 (patch)
treec871d16bf1f46a125e55913c6c35c3a75d4502b0 /sys/vm/vm_object.c
parentd382fc973f470775c34dc384cf8eef1be1e5ed54 (diff)
downloadFreeBSD-src-754f3790b85afd6cd15e69b91ee97848364f75f5.zip
FreeBSD-src-754f3790b85afd6cd15e69b91ee97848364f75f5.tar.gz
Merge from vmc-playground:
Introduce a new KPI that verifies if the page cache is empty for a specified vm_object. This KPI does not make assumptions about the locking in order to be used also for building assertions at init and destroy time. It is mostly used to hide implementation details of the page cache. Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: alc (vm_radix based version) Tested by: flo, pho, jhb, davide
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r--sys/vm/vm_object.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 1e588e3..372782b 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -173,7 +173,7 @@ vm_object_zdtor(void *mem, int size, void *arg)
("object %p has reservations",
object));
#endif
- KASSERT(object->cache == NULL,
+ KASSERT(vm_object_cache_is_empty(object),
("object %p has cached pages",
object));
KASSERT(object->paging_in_progress == 0,
@@ -752,7 +752,7 @@ vm_object_terminate(vm_object_t object)
if (__predict_false(!LIST_EMPTY(&object->rvq)))
vm_reserv_break_all(object);
#endif
- if (__predict_false(object->cache != NULL))
+ if (__predict_false(!vm_object_cache_is_empty(object)))
vm_page_cache_free(object, 0, 0);
/*
@@ -1377,7 +1377,7 @@ retry:
* should still be OBJT_DEFAULT and orig_object should not
* contain any cached pages within the specified range.
*/
- if (__predict_false(orig_object->cache != NULL))
+ if (__predict_false(!vm_object_cache_is_empty(orig_object)))
vm_page_cache_transfer(orig_object, offidxstart,
new_object);
}
@@ -1726,7 +1726,8 @@ vm_object_collapse(vm_object_t object)
/*
* Free any cached pages from backing_object.
*/
- if (__predict_false(backing_object->cache != NULL))
+ if (__predict_false(
+ !vm_object_cache_is_empty(backing_object)))
vm_page_cache_free(backing_object, 0, 0);
}
/*
@@ -1920,7 +1921,7 @@ again:
}
vm_object_pip_wakeup(object);
skipmemq:
- if (__predict_false(object->cache != NULL))
+ if (__predict_false(!vm_object_cache_is_empty(object)))
vm_page_cache_free(object, start, end);
}
OpenPOWER on IntegriCloud