svn commit: r208044 - stable/8/sys/vm

Konstantin Belousov kib at FreeBSD.org
Thu May 13 20:26:16 UTC 2010


Author: kib
Date: Thu May 13 20:26:16 2010
New Revision: 208044
URL: http://svn.freebsd.org/changeset/base/208044

Log:
  MFC elimination of several settings of PG_REFERENCED bit, that either
  do not make sense or are harmful.
  
  MFC r206761 (by alc):
  Setting PG_REFERENCED on the requested page in swap_pager_getpages() is
  either redundant or harmful, depending on the caller.
  
  MFC r206768 (by alc):
  In vm_object_backing_scan(), setting PG_REFERENCED on a page before
  sleeping on that page is nonsensical.
  
  MFC r206770 (by alc):
  In vm_object_madvise() setting PG_REFERENCED on a page before sleeping on
  that page only makes sense if the advice is MADV_WILLNEED.
  
  MFC r206801 (by alc):
  There is no justification for vm_object_split() setting PG_REFERENCED on a
  page that it is going to sleep on.

Modified:
  stable/8/sys/vm/swap_pager.c
  stable/8/sys/vm/vm_object.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/vm/swap_pager.c
==============================================================================
--- stable/8/sys/vm/swap_pager.c	Thu May 13 19:47:36 2010	(r208043)
+++ stable/8/sys/vm/swap_pager.c	Thu May 13 20:26:16 2010	(r208044)
@@ -1105,8 +1105,7 @@ swap_pager_getpages(vm_object_t object, 
 	 * happen.  Note that blk, iblk & jblk can be SWAPBLK_NONE, but the 
 	 * loops are set up such that the case(s) are handled implicitly.
 	 *
-	 * The swp_*() calls must be made at splvm().  vm_page_free() does
-	 * not need to be, but it will go a little faster if it is.
+	 * The swp_*() calls must be made with the object locked.
 	 */
 	blk = swp_pager_meta_ctl(mreq->object, mreq->pindex, 0);
 
@@ -1216,9 +1215,6 @@ swap_pager_getpages(vm_object_t object, 
 	VM_OBJECT_LOCK(object);
 	while ((mreq->oflags & VPO_SWAPINPROG) != 0) {
 		mreq->oflags |= VPO_WANTED;
-		vm_page_lock_queues();
-		vm_page_flag_set(mreq, PG_REFERENCED);
-		vm_page_unlock_queues();
 		PCPU_INC(cnt.v_intrans);
 		if (msleep(mreq, VM_OBJECT_MTX(object), PSWP, "swread", hz*20)) {
 			printf(

Modified: stable/8/sys/vm/vm_object.c
==============================================================================
--- stable/8/sys/vm/vm_object.c	Thu May 13 19:47:36 2010	(r208043)
+++ stable/8/sys/vm/vm_object.c	Thu May 13 20:26:16 2010	(r208044)
@@ -1205,12 +1205,19 @@ shadowlookup:
 			goto unlock_tobject;
 		}
 		if ((m->oflags & VPO_BUSY) || m->busy) {
-			vm_page_flag_set(m, PG_REFERENCED);
+			if (advise == MADV_WILLNEED)
+				/*
+				 * Reference the page before unlocking and
+				 * sleeping so that the page daemon is less
+				 * likely to reclaim it. 
+				 */
+				vm_page_flag_set(m, PG_REFERENCED);
 			vm_page_unlock_queues();
 			if (object != tobject)
 				VM_OBJECT_UNLOCK(object);
 			m->oflags |= VPO_WANTED;
-			msleep(m, VM_OBJECT_MTX(tobject), PDROP | PVM, "madvpo", 0);
+			msleep(m, VM_OBJECT_MTX(tobject), PDROP | PVM, "madvpo",
+			    0);
 			VM_OBJECT_LOCK(object);
   			goto relookup;
 		}
@@ -1415,7 +1422,6 @@ retry:
 		 * not be changed by this operation.
 		 */
 		if ((m->oflags & VPO_BUSY) || m->busy) {
-			vm_page_flag_set(m, PG_REFERENCED);
 			vm_page_unlock_queues();
 			VM_OBJECT_UNLOCK(new_object);
 			m->oflags |= VPO_WANTED;
@@ -1553,9 +1559,6 @@ vm_object_backing_scan(vm_object_t objec
 				}
 			} else if (op & OBSC_COLLAPSE_WAIT) {
 				if ((p->oflags & VPO_BUSY) || p->busy) {
-					vm_page_lock_queues();
-					vm_page_flag_set(p, PG_REFERENCED);
-					vm_page_unlock_queues();
 					VM_OBJECT_UNLOCK(object);
 					p->oflags |= VPO_WANTED;
 					msleep(p, VM_OBJECT_MTX(backing_object),


More information about the svn-src-all mailing list