svn commit: r248134 - user/attilio/vmcontention/sys/vm

Alan Cox alc at FreeBSD.org
Sun Mar 10 17:30:58 UTC 2013


Author: alc
Date: Sun Mar 10 17:30:57 2013
New Revision: 248134
URL: http://svnweb.freebsd.org/changeset/base/248134

Log:
  Introduce vm_radix_is_empty(), and use it in place of
  vm_object_cache_is_empty() where the caller is aware of the page cache's
  implementation as a radix trie.
  
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  user/attilio/vmcontention/sys/vm/_vm_radix.h
  user/attilio/vmcontention/sys/vm/vm_object.c
  user/attilio/vmcontention/sys/vm/vm_object.h
  user/attilio/vmcontention/sys/vm/vm_page.c

Modified: user/attilio/vmcontention/sys/vm/_vm_radix.h
==============================================================================
--- user/attilio/vmcontention/sys/vm/_vm_radix.h	Sun Mar 10 17:10:16 2013	(r248133)
+++ user/attilio/vmcontention/sys/vm/_vm_radix.h	Sun Mar 10 17:30:57 2013	(r248134)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2013 EMC Corp.
  * Copyright (c) 2011 Jeffrey Roberson <jeff at freebsd.org>
  * Copyright (c) 2008 Mayur Shardul <mayur.shardul at gmail.com>
  * All rights reserved.
@@ -36,4 +37,11 @@ struct vm_radix {
 	uintptr_t	rt_root;
 };
 
+static __inline boolean_t
+vm_radix_is_empty(struct vm_radix *rtree)
+{
+
+	return (rtree->rt_root == 0);
+}
+
 #endif /* !__VM_RADIX_H_ */

Modified: user/attilio/vmcontention/sys/vm/vm_object.c
==============================================================================
--- user/attilio/vmcontention/sys/vm/vm_object.c	Sun Mar 10 17:10:16 2013	(r248133)
+++ user/attilio/vmcontention/sys/vm/vm_object.c	Sun Mar 10 17:30:57 2013	(r248134)
@@ -168,7 +168,7 @@ vm_object_zdtor(void *mem, int size, voi
 	object = (vm_object_t)mem;
 	KASSERT(TAILQ_EMPTY(&object->memq),
 	    ("object %p has resident pages in its memq", object));
-	KASSERT(object->rtree.rt_root == 0,
+	KASSERT(vm_radix_is_empty(&object->rtree),
 	    ("object %p has resident pages in its trie", object));
 #if VM_NRESERVLEVEL > 0
 	KASSERT(LIST_EMPTY(&object->rvq),

Modified: user/attilio/vmcontention/sys/vm/vm_object.h
==============================================================================
--- user/attilio/vmcontention/sys/vm/vm_object.h	Sun Mar 10 17:10:16 2013	(r248133)
+++ user/attilio/vmcontention/sys/vm/vm_object.h	Sun Mar 10 17:30:57 2013	(r248134)
@@ -248,7 +248,7 @@ static __inline boolean_t
 vm_object_cache_is_empty(vm_object_t object)
 {
 
-	return (object->cache.rt_root == 0);
+	return (vm_radix_is_empty(&object->cache));
 }
 
 vm_object_t vm_object_allocate (objtype_t, vm_pindex_t);

Modified: user/attilio/vmcontention/sys/vm/vm_page.c
==============================================================================
--- user/attilio/vmcontention/sys/vm/vm_page.c	Sun Mar 10 17:10:16 2013	(r248133)
+++ user/attilio/vmcontention/sys/vm/vm_page.c	Sun Mar 10 17:30:57 2013	(r248134)
@@ -1018,7 +1018,7 @@ vm_page_cache_free(vm_object_t object, v
 	boolean_t empty;
 
 	mtx_lock(&vm_page_queue_free_mtx);
-	if (__predict_false(vm_object_cache_is_empty(object))) {
+	if (__predict_false(vm_radix_is_empty(&object->cache))) {
 		mtx_unlock(&vm_page_queue_free_mtx);
 		return;
 	}
@@ -1035,7 +1035,7 @@ vm_page_cache_free(vm_object_t object, v
 		cnt.v_cache_count--;
 		cnt.v_free_count++;
 	}
-	empty = vm_object_cache_is_empty(object);
+	empty = vm_radix_is_empty(&object->cache);
 	mtx_unlock(&vm_page_queue_free_mtx);
 	if (object->type == OBJT_VNODE && empty)
 		vdrop(object->handle);
@@ -1096,7 +1096,7 @@ vm_page_cache_transfer(vm_object_t orig_
 	 * not.
 	 */
 	VM_OBJECT_ASSERT_WLOCKED(new_object);
-	KASSERT(vm_object_cache_is_empty(new_object),
+	KASSERT(vm_radix_is_empty(&new_object->cache),
 	    ("vm_page_cache_transfer: object %p has cached pages",
 	    new_object));
 	mtx_lock(&vm_page_queue_free_mtx);
@@ -2186,7 +2186,7 @@ vm_page_cache(vm_page_t m)
 	mtx_lock(&vm_page_queue_free_mtx);
 	m->flags |= PG_CACHED;
 	cnt.v_cache_count++;
-	cache_was_empty = vm_object_cache_is_empty(object);
+	cache_was_empty = vm_radix_is_empty(&object->cache);
 	vm_radix_insert(&object->cache, m->pindex, m);
 #if VM_NRESERVLEVEL > 0
 	if (!vm_reserv_free_page(m)) {


More information about the svn-src-user mailing list