PERFORCE change 90849 for review

Alan Cox alc at FreeBSD.org
Tue Jan 31 15:41:31 PST 2006


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

Change 90849 by alc at alc_home on 2006/01/31 23:41:03

	Introduce vm_buddyq_find() and use it to reclaim pages from the cache
	queues in vm_page_select_cache().

Affected files ...

.. //depot/projects/superpages/src/sys/vm/vm_buddy.h#8 edit
.. //depot/projects/superpages/src/sys/vm/vm_page.c#17 edit

Differences ...

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

@@ -5,3 +5,16 @@
 void buddy_free(vm_page_t m, int magn);
 void buddy_free_locked(int baseq, vm_page_t m, int magn);
 void buddy_unfree(vm_page_t m);
+
+static __inline vm_page_t
+vm_buddyq_find(int baseq)
+{
+	vm_page_t m;
+	int q;
+
+	q = 0;
+	while ((m = TAILQ_FIRST(&vm_page_queues[baseq + q].pl)) == NULL &&
+	    q < BUDDY_QUEUES)
+		q++;
+	return (m);
+}

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

@@ -737,7 +737,7 @@
 	boolean_t was_trylocked;
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	while ((m = TAILQ_FIRST(&vm_page_queues[PQ_CACHE].pl)) != NULL) {
+	while ((m = vm_buddyq_find(PQ_CACHE)) != NULL) {
 		KASSERT(m->dirty == 0, ("Found dirty cache page %p", m));
 		KASSERT(!pmap_page_is_mapped(m),
 		    ("Found mapped cache page %p", m));


More information about the p4-projects mailing list