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

Attilio Rao attilio at FreeBSD.org
Thu Mar 1 00:54:09 UTC 2012


Author: attilio
Date: Thu Mar  1 00:54:08 2012
New Revision: 232326
URL: http://svn.freebsd.org/changeset/base/232326

Log:
  - Exclude vm_radix_shrink() from the interface but retain the code
    still as it can be useful.
  - Make most of the interface private as it is unnecessary public right
    now.  This will help in making nodes changing with arch and still avoid
    namespace pollution.

Modified:
  user/attilio/vmcontention/sys/vm/vm_radix.c
  user/attilio/vmcontention/sys/vm/vm_radix.h

Modified: user/attilio/vmcontention/sys/vm/vm_radix.c
==============================================================================
--- user/attilio/vmcontention/sys/vm/vm_radix.c	Thu Mar  1 00:27:51 2012	(r232325)
+++ user/attilio/vmcontention/sys/vm/vm_radix.c	Thu Mar  1 00:54:08 2012	(r232326)
@@ -54,9 +54,32 @@
 
 #include <sys/kdb.h>
 
+#define	VM_RADIX_WIDTH	5
+#define	VM_RADIX_COUNT	(1 << VM_RADIX_WIDTH)
+#define	VM_RADIX_MASK	(VM_RADIX_COUNT - 1)
+#define	VM_RADIX_MAXVAL	((vm_pindex_t)-1)
+#define	VM_RADIX_LIMIT	howmany((sizeof(vm_pindex_t) * NBBY), VM_RADIX_WIDTH)
+
+/* Flag bits stored in node pointers. */
+#define VM_RADIX_FLAGS	0x3
+
+/* Bits of height in root. */
+#define VM_RADIX_HEIGHT	0xf
+
+/* Calculates maximum value for a tree of height h. */
+#define	VM_RADIX_MAX(h)							\
+	    ((h) == VM_RADIX_LIMIT ? VM_RADIX_MAXVAL :			\
+	    (((vm_pindex_t)1 << ((h) * VM_RADIX_WIDTH)) - 1))
+
+CTASSERT(VM_RADIX_HEIGHT >= VM_RADIX_LIMIT);
 CTASSERT(sizeof(struct vm_radix_node) < PAGE_SIZE);
 CTASSERT((sizeof(u_int) * NBBY) >= VM_RADIX_LIMIT);
 
+struct vm_radix_node {
+	void		*rn_child[VM_RADIX_COUNT];	/* Child nodes. */
+	volatile uint32_t rn_count;			/* Valid children. */
+};
+
 static uma_zone_t vm_radix_node_zone;
 
 #ifndef UMA_MD_SMALL_ALLOC
@@ -789,6 +812,7 @@ vm_radix_reclaim_allnodes(struct vm_radi
 	rtree->rt_root = 0;
 }
 
+#ifdef notyet
 /*
  * Attempts to reduce the height of the tree.
  */
@@ -818,3 +842,4 @@ vm_radix_shrink(struct vm_radix *rtree)
 	}
 	vm_radix_setroot(rtree, root, level);
 }
+#endif

Modified: user/attilio/vmcontention/sys/vm/vm_radix.h
==============================================================================
--- user/attilio/vmcontention/sys/vm/vm_radix.h	Thu Mar  1 00:27:51 2012	(r232325)
+++ user/attilio/vmcontention/sys/vm/vm_radix.h	Thu Mar  1 00:54:08 2012	(r232326)
@@ -29,27 +29,11 @@
 #ifndef _VM_RADIX_H_
 #define _VM_RADIX_H_
 
-#include <sys/queue.h>
-
-/* Default values of the tree parameters */
-#define	VM_RADIX_WIDTH	5
-#define	VM_RADIX_COUNT	(1 << VM_RADIX_WIDTH)
-#define	VM_RADIX_MASK	(VM_RADIX_COUNT - 1)
-#define	VM_RADIX_MAXVAL	((vm_pindex_t)-1)
-#define	VM_RADIX_LIMIT	howmany((sizeof(vm_pindex_t) * NBBY), VM_RADIX_WIDTH)
-#define	VM_RADIX_FLAGS	0x3	/* Flag bits stored in node pointers. */
 #define	VM_RADIX_BLACK	0x1	/* Black node. (leaf only) */
 #define	VM_RADIX_RED	0x2	/* Red node. (leaf only) */
 #define	VM_RADIX_ANY	(VM_RADIX_RED | VM_RADIX_BLACK)
-#define	VM_RADIX_EMPTY	0x1	/* Empty hint. (internal only) */
-#define	VM_RADIX_HEIGHT	0xf	/* Bits of height in root */
 #define	VM_RADIX_STACK	8	/* Nodes to store on stack. */
 
-/* Calculates maximum value for a tree of height h. */
-#define	VM_RADIX_MAX(h)							\
-	    ((h) == VM_RADIX_LIMIT ? VM_RADIX_MAXVAL :			\
-	    (((vm_pindex_t)1 << ((h) * VM_RADIX_WIDTH)) - 1))
-
 /*
  * Radix tree root.  The height and pointer are set together to permit
  * coherent lookups while the root is modified.
@@ -59,20 +43,16 @@ struct vm_radix {
 };
 
 #ifdef _KERNEL
-CTASSERT(VM_RADIX_HEIGHT >= VM_RADIX_LIMIT);
-
-struct vm_radix_node {
-	void		*rn_child[VM_RADIX_COUNT];	/* Child nodes. */
-    	volatile uint32_t rn_count;			/* Valid children. */
-};
 
+/*
+ * Initialize the radix tree subsystem.
+ */
 void	vm_radix_init(void);
 
 /*
  * Functions which only work with black nodes. (object lock)
  */
 int 	vm_radix_insert(struct vm_radix *, vm_pindex_t, void *);
-void 	vm_radix_shrink(struct vm_radix *);
 
 /*
  * Functions which work on specified colors. (object, vm_page_queue_free locks)


More information about the svn-src-user mailing list