PERFORCE change 90652 for review

Alan Cox alc at FreeBSD.org
Sun Jan 29 14:54:34 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=90652

Change 90652 by alc at alc_home on 2006/01/29 22:54:09

	Tidy up.  There are no functional changes.
	
	Reviewed by:	md5

Affected files ...

.. //depot/projects/superpages/src/sys/vm/vm_buddy.c#10 edit

Differences ...

==== //depot/projects/superpages/src/sys/vm/vm_buddy.c#10 (text+ko) ====

@@ -53,6 +53,12 @@
 SYSCTL_OID(_vm, OID_AUTO, buddy, CTLTYPE_STRING | CTLFLAG_RD,
     NULL, 0, sysctl_vm_buddy, "A", "Buddy Info");
 
+static __inline void buddyq_insert(int baseq, int q, vm_page_t m);
+static __inline void buddyq_remove(vm_page_t m);
+static __inline void buddyq_split(vm_page_t m, int q, int Q);
+
+static vm_page_t phys_to_vm_page(vm_paddr_t pa);
+
 /*
  *
  */
@@ -82,12 +88,11 @@
  *
  */
 static __inline void
-buddy_insert(int baseq, int q, vm_page_t m)
+buddyq_insert(int baseq, int q, vm_page_t m)
 {
 
 	KASSERT(m->queue == PQ_NONE,
-	    ("vm_page_buddy_insert: page %p has unexpected queue %d",
-	    m, m->queue));
+	    ("buddyq_insert: page %p has unexpected queue %d", m, m->queue));
 	m->buddyq = q;
 	m->queue = baseq + q;
 	if (baseq != PQ_FREE || (m->flags & PG_ZERO) != 0)
@@ -101,7 +106,7 @@
  *
  */
 static __inline void
-buddy_remove(vm_page_t m)
+buddyq_remove(vm_page_t m)
 {
 
 	TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
@@ -113,7 +118,7 @@
  *
  */
 static __inline void
-vm_page_buddy_split(vm_page_t m, int q, int Q)
+buddyq_split(vm_page_t m, int q, int Q)
 {
 	vm_page_t m_buddy;
 
@@ -122,9 +127,9 @@
 		m_buddy = &m[1 << q];
 		KASSERT(VM_PAGE_TO_PHYS(m_buddy) == VM_PAGE_TO_PHYS(m) +
 		    (1 << (PAGE_SHIFT + q)),
-		    ("vm_page_buddy_split: page %p is not page %p's %d buddy",
+		    ("buddyq_split: page %p is not page %p's %d buddy",
 		    m_buddy, m, q));
-		buddy_insert(PQ_FREE, q, m_buddy);
+		buddyq_insert(PQ_FREE, q, m_buddy);
         }
 }
 
@@ -157,8 +162,8 @@
 		m = prefer_zero ? TAILQ_LAST(&vm_page_queues[PQ_FREE + q].pl,
 		    pglist) : TAILQ_FIRST(&vm_page_queues[PQ_FREE + q].pl);
 		if (m != NULL) {
-			buddy_remove(m);
-			vm_page_buddy_split(m, q, Q);
+			buddyq_remove(m);
+			buddyq_split(m, q, Q);
 			cnt.v_free_count -= 1 << Q;
 			return (m);
 		}
@@ -229,12 +234,12 @@
 		    buddy->buddyq != q ||
 		    !VM_PAGE_INQUEUE1(buddy, baseq))
 			break;
-		buddy_remove(buddy);
+		buddyq_remove(buddy);
 		q++;
 		pa &= ~((1 << (PAGE_SHIFT + q)) - 1);
 		m = PHYS_TO_VM_PAGE(pa);
 	}
-	buddy_insert(baseq, q, m);
+	buddyq_insert(baseq, q, m);
 }
 
 /*
@@ -269,7 +274,7 @@
 	 * there. For that, we remove the whole chunk, return the half
 	 * where m is not, and iterate.
 	 */
-	buddy_remove(buddy);
+	buddyq_remove(buddy);
 	while (q > 0) {
 		q--;
 		half = buddy->phys_addr ^ (1 << (PAGE_SHIFT + q));
@@ -279,7 +284,7 @@
 			other = buddy;
 			buddy = PHYS_TO_VM_PAGE(half);
 		}
-		buddy_insert(PQ_CACHE, q, other);
+		buddyq_insert(PQ_CACHE, q, other);
 	}
 	cnt.v_cache_count--;
 	KASSERT(buddy == m, ("buddy_unfree: yyy"));
@@ -356,8 +361,8 @@
         return (NULL);
 done:
 	for (m = m_ret; m < &m_ret[npages]; m = &m[1 << q])
-		buddy_remove(m);
-	vm_page_buddy_split(m_ret, q, Q);
+		buddyq_remove(m);
+	buddyq_split(m_ret, q, Q);
 	cnt.v_free_count -= roundup2(npages, 1 << imin(q, Q));
         for (i = 0; i < npages; i++) {
 		m = &m_ret[i];


More information about the p4-projects mailing list