From 8fcdfb646d145f285341ef597568bb9e003ce28f Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Fri, 17 Jun 2016 12:50:45 +0200 Subject: Change page cache statistics Instead of reporting statistics about unreferenced objects (the object cache), report statistics about external objects (the page cache). * vm/vm_object.c (vm_object_cached_count): Remove variable. (vm_object_cache_add): Remove object cache stats updates. (vm_object_cache_remove): Likewise. (vm_object_terminate): Update page cache stats. * vm/vm_object.h (vm_object_cached_count): Remove variable. (vm_object_cached_pages): Likewise. (vm_object_cached_pages_lock_data): Likewise. (vm_object_cached_pages_update): Remove macro. (vm_object_external_count): New extern variable. (vm_object_external_pages): Likewise. * vm/vm_resident.c (vm_object_external_count): New variable. (vm_object_external_pages): Likewise. (vm_page_insert): Remove object cache stats updates and update page cache stats. (vm_page_replace): Likewise. (vm_page_remove): Likewise. * vm/vm_user.c (vm_cache_statistics): Report page cache stats instead of object cache stats. --- vm/vm_object.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'vm/vm_object.c') diff --git a/vm/vm_object.c b/vm/vm_object.c index 046b6c49..1e80bbca 100644 --- a/vm/vm_object.c +++ b/vm/vm_object.c @@ -181,7 +181,6 @@ vm_object_t kernel_object = &kernel_object_store; * not be held to make simple references. */ queue_head_t vm_object_cached_list; -int vm_object_cached_count; decl_simple_lock_data(,vm_object_cached_lock_data) @@ -362,8 +361,6 @@ static void vm_object_cache_add( { assert(!object->cached); queue_enter(&vm_object_cached_list, object, vm_object_t, cached_list); - vm_object_cached_count++; - vm_object_cached_pages_update(object->resident_page_count); object->cached = TRUE; } @@ -372,8 +369,6 @@ static void vm_object_cache_remove( { assert(object->cached); queue_remove(&vm_object_cached_list, object, vm_object_t, cached_list); - vm_object_cached_count--; - vm_object_cached_pages_update(-object->resident_page_count); object->cached = FALSE; } @@ -621,6 +616,14 @@ void vm_object_terminate( assert(object->paging_in_progress == 0); assert(!object->cached); + if (!object->internal) { + assert(object->resident_page_count == 0); + + vm_page_lock_queues(); + vm_object_external_count--; + vm_page_unlock_queues(); + } + /* * Throw away port rights... note that they may * already have been thrown away (by vm_object_destroy @@ -2091,6 +2094,9 @@ restart: object->internal = FALSE; object->temporary = FALSE; + assert(object->resident_page_count == 0); + vm_object_external_count++; + /* user pager objects are not ready until marked so */ object->pager_ready = FALSE; -- cgit v1.2.3