Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jun 2009 19:38:26 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r193643 - in head/sys: kern vm
Message-ID:  <200906071938.n57JcQgE003064@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Jun  7 19:38:26 2009
New Revision: 193643
URL: http://svn.freebsd.org/changeset/base/193643

Log:
  Eliminate unnecessary obfuscation when testing a page's valid bits.

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/vfs_cluster.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_glue.c
  head/sys/vm/vm_map.c

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Sun Jun  7 19:36:25 2009	(r193642)
+++ head/sys/kern/kern_exec.c	Sun Jun  7 19:38:26 2009	(r193643)
@@ -927,7 +927,7 @@ exec_map_first_page(imgp)
 	}
 #endif
 	ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
-	if ((ma[0]->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
+	if (ma[0]->valid != VM_PAGE_BITS_ALL) {
 		initial_pagein = VM_INITIAL_PAGEIN;
 		if (initial_pagein > object->size)
 			initial_pagein = object->size;

Modified: head/sys/kern/vfs_cluster.c
==============================================================================
--- head/sys/kern/vfs_cluster.c	Sun Jun  7 19:36:25 2009	(r193642)
+++ head/sys/kern/vfs_cluster.c	Sun Jun  7 19:38:26 2009	(r193643)
@@ -455,7 +455,7 @@ cluster_rbuild(vp, filesize, lbn, blkno,
 				bp->b_pages[bp->b_npages] = m;
 				bp->b_npages++;
 			}
-			if ((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL)
+			if (m->valid == VM_PAGE_BITS_ALL)
 				tbp->b_pages[j] = bogus_page;
 		}
 		VM_OBJECT_UNLOCK(tbp->b_bufobj->bo_object);
@@ -482,10 +482,8 @@ cluster_rbuild(vp, filesize, lbn, blkno,
 	VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
 	for (j = 0; j < bp->b_npages; j++) {
 		VM_OBJECT_LOCK_ASSERT(bp->b_pages[j]->object, MA_OWNED);
-		if ((bp->b_pages[j]->valid & VM_PAGE_BITS_ALL) ==
-		    VM_PAGE_BITS_ALL) {
+		if (bp->b_pages[j]->valid == VM_PAGE_BITS_ALL)
 			bp->b_pages[j] = bogus_page;
-		}
 	}
 	VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object);
 	if (bp->b_bufsize > bp->b_kvasize)

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Sun Jun  7 19:36:25 2009	(r193642)
+++ head/sys/vm/vm_fault.c	Sun Jun  7 19:38:26 2009	(r193643)
@@ -394,7 +394,7 @@ RetryFault:;
 			 * found the page ).
 			 */
 			vm_page_busy(fs.m);
-			if (((fs.m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) &&
+			if (fs.m->valid != VM_PAGE_BITS_ALL &&
 				fs.m->object != kernel_object && fs.m->object != kmem_object) {
 				goto readrest;
 			}
@@ -433,7 +433,7 @@ RetryFault:;
 				unlock_and_deallocate(&fs);
 				VM_WAITPFAULT;
 				goto RetryFault;
-			} else if ((fs.m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL)
+			} else if (fs.m->valid == VM_PAGE_BITS_ALL)
 				break;
 		}
 
@@ -1024,9 +1024,8 @@ vm_fault_prefault(pmap_t pmap, vm_offset
 			VM_OBJECT_UNLOCK(lobject);
 			break;
 		}
-		if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
+		if (m->valid == VM_PAGE_BITS_ALL &&
 		    (m->flags & PG_FICTITIOUS) == 0) {
-
 			vm_page_lock_queues();
 			pmap_enter_quick(pmap, addr, m, entry->protection);
 			vm_page_unlock_queues();

Modified: head/sys/vm/vm_glue.c
==============================================================================
--- head/sys/vm/vm_glue.c	Sun Jun  7 19:36:25 2009	(r193642)
+++ head/sys/vm/vm_glue.c	Sun Jun  7 19:38:26 2009	(r193643)
@@ -253,7 +253,7 @@ vm_imgact_hold_page(vm_object_t object, 
 	VM_OBJECT_LOCK(object);
 	pindex = OFF_TO_IDX(offset);
 	m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
-	if ((m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
+	if (m->valid != VM_PAGE_BITS_ALL) {
 		ma[0] = m;
 		rv = vm_pager_get_pages(object, ma, 1, 0);
 		m = vm_page_lookup(object, pindex);

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Sun Jun  7 19:36:25 2009	(r193642)
+++ head/sys/vm/vm_map.c	Sun Jun  7 19:38:26 2009	(r193643)
@@ -1683,7 +1683,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offse
 			psize = tmpidx;
 			break;
 		}
-		if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) {
+		if (p->valid == VM_PAGE_BITS_ALL) {
 			if (p_start == NULL) {
 				start = addr + ptoa(tmpidx);
 				p_start = p;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906071938.n57JcQgE003064>