Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PERFORCE change 90443 for review



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

Change 90443 by alc@alc_home on 2006/01/27 02:30:26

	Utilize the new VM_PAGE_*() macros to minimize the differences with
	HEAD.

Affected files ...

.. //depot/projects/superpages/src/sys/kern/vfs_bio.c#5 edit
.. //depot/projects/superpages/src/sys/vm/vm_contig.c#7 edit
.. //depot/projects/superpages/src/sys/vm/vm_fault.c#4 edit
.. //depot/projects/superpages/src/sys/vm/vm_page.c#11 edit
.. //depot/projects/superpages/src/sys/vm/vm_page.h#5 edit
.. //depot/projects/superpages/src/sys/vm/vm_pageout.c#6 edit
.. //depot/projects/superpages/src/sys/vm/vm_pageq.c#7 edit

Differences ...

==== //depot/projects/superpages/src/sys/kern/vfs_bio.c#5 (text+ko) ====

@@ -2864,7 +2864,7 @@
 				 * page daemon?
 				 */
 				if ((curproc != pageproc) &&
-				    m->queue == PQ_CACHE &&
+				    (VM_PAGE_INQUEUE1(m, PQ_CACHE)) &&
 				    ((cnt.v_free_count + cnt.v_cache_count) <
 			 		(cnt.v_free_min + cnt.v_cache_min))) {
 					pagedaemon_wakeup();

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

@@ -143,7 +143,7 @@
 		if ((m->flags & PG_MARKER) != 0)
 			continue;
 
-		KASSERT(m->queue == queue,
+		KASSERT(VM_PAGE_INQUEUE2(m, queue),
 		    ("vm_contig_launder: page %p's queue is not %d", m, queue));
 		error = vm_contig_launder_page(m);
 		if (error == 0)

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

@@ -1010,7 +1010,7 @@
 		    (m->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
 
 			vm_page_lock_queues();
-			if (m->queue == PQ_CACHE)
+			if (VM_PAGE_INQUEUE1(m, PQ_CACHE))
 				vm_page_deactivate(m);
 			mpte = pmap_enter_quick(pmap, addr, m,
 			    entry->protection, mpte);

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

@@ -390,7 +390,7 @@
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	--mem->hold_count;
 	KASSERT(mem->hold_count >= 0, ("vm_page_unhold: hold count < 0!!!"));
-	if (mem->hold_count == 0 && mem->queue == PQ_HOLD)
+	if (mem->hold_count == 0 && VM_PAGE_INQUEUE2(mem, PQ_HOLD))
 		vm_page_free_toq(mem);
 }
 
@@ -465,7 +465,7 @@
 void
 vm_page_dirty(vm_page_t m)
 {
-	KASSERT(m->queue != PQ_CACHE,
+	KASSERT(VM_PAGE_GETKNOWNQUEUE1(m) != PQ_CACHE,
 	    ("vm_page_dirty: page in cache!"));
 	KASSERT((m->queue - m->buddyq) != PQ_BUDDY,
 	    ("vm_page_dirty: page is free!"));
@@ -715,7 +715,7 @@
 
 	vm_page_remove(m);
 	vm_page_insert(m, new_object, new_pindex);
-	if (m->queue == PQ_CACHE)
+	if (VM_PAGE_INQUEUE1(m, PQ_CACHE))
 		vm_page_deactivate(m);
 	vm_page_dirty(m);
 }
@@ -966,8 +966,8 @@
 {
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	if (m->queue != PQ_ACTIVE) {
-		if (m->queue == PQ_CACHE)
+	if (VM_PAGE_GETKNOWNQUEUE2(m) != PQ_ACTIVE) {
+		if (VM_PAGE_INQUEUE1(m, PQ_CACHE))
 			cnt.v_reactivated++;
 		vm_pageq_remove(m);
 		if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) {
@@ -1230,7 +1230,7 @@
 	/*
 	 * Ignore if already inactive.
 	 */
-	if (m->queue == PQ_INACTIVE)
+	if (VM_PAGE_INQUEUE2(m, PQ_INACTIVE))
 		return;
 	if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) {
 		if (m->queue == PQ_CACHE)
@@ -1241,7 +1241,7 @@
 			TAILQ_INSERT_HEAD(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
 		else
 			TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
-		m->queue = PQ_INACTIVE;
+		VM_PAGE_SETQUEUE2(m, PQ_INACTIVE);
 		vm_page_queues[PQ_INACTIVE].lcnt++;
 		cnt.v_inactive_count++;
 	}
@@ -1317,7 +1317,7 @@
 		printf("vm_page_cache: attempting to cache busy page\n");
 		return;
 	}
-	if (m->queue == PQ_CACHE)
+	if (VM_PAGE_INQUEUE1(m, PQ_CACHE))
 		return;
 
 	/*
@@ -1369,8 +1369,9 @@
 	 * occassionally leave the page alone
 	 */
 	if ((dnw & 0x01F0) == 0 ||
-	    m->queue == PQ_INACTIVE || 
-	    m->queue == PQ_CACHE) {
+	    VM_PAGE_INQUEUE2(m, PQ_INACTIVE) || 
+	    VM_PAGE_INQUEUE1(m, PQ_CACHE)
+	) {
 		if (m->act_count >= ACT_INIT)
 			--m->act_count;
 		return;

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

@@ -153,6 +153,24 @@
 #define PQ_HOLD  (4 + BUDDY_QUEUES)
 #define PQ_COUNT (5 + BUDDY_QUEUES)
 
+/* Returns the real queue a page is on. */
+#define VM_PAGE_GETQUEUE(m)	((m)->queue)
+
+/* Returns the well known queue a page is on. */
+#define VM_PAGE_GETKNOWNQUEUE1(m)	((m)->queue)
+#define VM_PAGE_GETKNOWNQUEUE2(m)	VM_PAGE_GETQUEUE(m)
+
+/* Given the real queue number and a page color return the well know queue. */
+#define VM_PAGE_RESOLVEQUEUE(m, q)	((q))
+
+/* Returns true if the page is in the named well known queue. */
+#define VM_PAGE_INQUEUE1(m, q)	(VM_PAGE_GETKNOWNQUEUE1(m) == (q))
+#define VM_PAGE_INQUEUE2(m, q)	(VM_PAGE_GETKNOWNQUEUE2(m) == (q))
+
+/* Sets the queue a page is on. */
+#define VM_PAGE_SETQUEUE1(m, q)	(VM_PAGE_GETQUEUE(m) = (q))
+#define VM_PAGE_SETQUEUE2(m, q)	(VM_PAGE_GETQUEUE(m) = (q))
+
 struct vpgqueues {
 	struct pglist pl;
 	int	*cnt;

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

@@ -740,7 +740,7 @@
 
 		cnt.v_pdpages++;
 
-		if (m->queue != PQ_INACTIVE) {
+		if (VM_PAGE_GETQUEUE(m) != PQ_INACTIVE) {
 			goto rescan0;
 		}
 
@@ -956,7 +956,7 @@
 				 * reused for another vnode.  The object might
 				 * have been reused for another vnode.
 				 */
-				if (m->queue != PQ_INACTIVE ||
+				if (VM_PAGE_GETQUEUE(m) != PQ_INACTIVE ||
 				    m->object != object ||
 				    object->handle != vp) {
 					if (object->flags & OBJ_MIGHTBEDIRTY)
@@ -1038,7 +1038,7 @@
 
 	while ((m != NULL) && (pcount-- > 0) && (page_shortage > 0)) {
 
-		KASSERT(m->queue == PQ_ACTIVE,
+		KASSERT(VM_PAGE_INQUEUE2(m, PQ_ACTIVE),
 		    ("vm_pageout_scan: page %p isn't active", m));
 
 		next = TAILQ_NEXT(m, pageq);
@@ -1309,7 +1309,7 @@
 	while ((m != NULL) && (pcount-- > 0)) {
 		int actcount;
 
-		KASSERT(m->queue == PQ_ACTIVE,
+		KASSERT(VM_PAGE_INQUEUE2(m, PQ_ACTIVE),
 		    ("vm_pageout_page_stats: page %p isn't active", m));
 
 		next = TAILQ_NEXT(m, pageq);

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

@@ -73,7 +73,7 @@
 void
 vm_pageq_requeue(vm_page_t m)
 {
-	int queue = m->queue;
+	int queue = VM_PAGE_GETQUEUE(m);
 	struct vpgqueues *vpq;
 
 	if (queue != PQ_NONE) {
@@ -93,7 +93,7 @@
 	struct vpgqueues *vpq;
 
 	vpq = &vm_page_queues[queue];
-	m->queue = queue;
+	VM_PAGE_SETQUEUE2(m, queue);
 	TAILQ_INSERT_TAIL(&vpq->pl, m, pageq);
 	++*vpq->cnt;
 	++vpq->lcnt;
@@ -161,12 +161,12 @@
 void
 vm_pageq_remove_nowakeup(vm_page_t m)
 {
-	int queue = m->queue;
+	int queue = VM_PAGE_GETQUEUE(m);
 	struct vpgqueues *pq;
 
 	if (queue != PQ_NONE) {
 		pq = &vm_page_queues[queue];
-		m->queue = PQ_NONE;
+		VM_PAGE_SETQUEUE2(m, PQ_NONE);
 		TAILQ_REMOVE(&pq->pl, m, pageq);
 		(*pq->cnt)--;
 		pq->lcnt--;
@@ -184,11 +184,11 @@
 void
 vm_pageq_remove(vm_page_t m)
 {
-	int queue = m->queue;
+	int queue = VM_PAGE_GETQUEUE(m);
 	struct vpgqueues *pq;
 
 	if (queue != PQ_NONE) {
-		m->queue = PQ_NONE;
+		VM_PAGE_SETQUEUE2(m, PQ_NONE);
 		pq = &vm_page_queues[queue];
 		KASSERT((m->queue - m->buddyq) != PQ_BUDDY,("vm_pageq_remove: page is un buddy allocator"));
 		TAILQ_REMOVE(&pq->pl, m, pageq);