Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2019 03:38:03 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353537 - head/sys/vm
Message-ID:  <201910150338.x9F3c31W023017@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jeff
Date: Tue Oct 15 03:38:02 2019
New Revision: 353537
URL: https://svnweb.freebsd.org/changeset/base/353537

Log:
  (2/6) Don't release xbusy in vm_page_remove(), defer to vm_page_free_prep().
  
  This persists busy state across operations like rename and replace.
  
  Reviewed by:    kib, markj
  Tested by:      pho
  Sponsored by:   Netflix, Intel
  Differential Revision:  https://reviews.freebsd.org/D21549

Modified:
  head/sys/vm/device_pager.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c

Modified: head/sys/vm/device_pager.c
==============================================================================
--- head/sys/vm/device_pager.c	Tue Oct 15 03:37:21 2019	(r353536)
+++ head/sys/vm/device_pager.c	Tue Oct 15 03:38:02 2019	(r353537)
@@ -236,6 +236,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m)
 		KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m));
 		pmap_remove_all(m);
 		(void)vm_page_remove(m);
+		vm_page_xunbusy(m);
 	} else if (object->type == OBJT_DEVICE)
 		dev_pager_free_page(object, m);
 }

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Tue Oct 15 03:37:21 2019	(r353536)
+++ head/sys/vm/vm_fault.c	Tue Oct 15 03:38:02 2019	(r353537)
@@ -1231,11 +1231,6 @@ readrest:
 				    fs.object, OFF_TO_IDX(
 				    fs.first_object->backing_object_offset));
 #endif
-				/*
-				 * Removing the page from the backing object
-				 * unbusied it.
-				 */
-				vm_page_xbusy(fs.m);
 				fs.first_m = fs.m;
 				fs.m = NULL;
 				VM_CNT_INC(v_cow_optim);

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Tue Oct 15 03:37:21 2019	(r353536)
+++ head/sys/vm/vm_object.c	Tue Oct 15 03:38:02 2019	(r353537)
@@ -1366,7 +1366,6 @@ retry:
 			VM_OBJECT_WLOCK(new_object);
 			goto retry;
 		}
-		/* Rename released the xbusy lock. */
 
 #if VM_NRESERVLEVEL > 0
 		/*
@@ -1383,8 +1382,8 @@ retry:
 		 */
 		vm_reserv_rename(m, new_object, orig_object, offidxstart);
 #endif
-		if (orig_object->type == OBJT_SWAP)
-			vm_page_xbusy(m);
+		if (orig_object->type != OBJT_SWAP)
+			vm_page_xunbusy(m);
 	}
 	if (orig_object->type == OBJT_SWAP) {
 		/*
@@ -1538,6 +1537,8 @@ vm_object_collapse_scan(vm_object_t object, int op)
 			    ("freeing mapped page %p", p));
 			if (vm_page_remove(p))
 				vm_page_free(p);
+			else
+				vm_page_xunbusy(p);
 			continue;
 		}
 
@@ -1579,6 +1580,8 @@ vm_object_collapse_scan(vm_object_t object, int op)
 			    ("freeing mapped page %p", p));
 			if (vm_page_remove(p))
 				vm_page_free(p);
+			else
+				vm_page_xunbusy(p);
 			if (pp != NULL)
 				vm_page_xunbusy(pp);
 			continue;
@@ -1599,7 +1602,6 @@ vm_object_collapse_scan(vm_object_t object, int op)
 			    op);
 			continue;
 		}
-		/* Rename released the xbusy lock. */
 
 		/* Use the old pindex to free the right page. */
 		if (backing_object->type == OBJT_SWAP)
@@ -1613,6 +1615,7 @@ vm_object_collapse_scan(vm_object_t object, int op)
 		vm_reserv_rename(p, object, backing_object,
 		    backing_offset_index);
 #endif
+		vm_page_xunbusy(p);
 	}
 	return (true);
 }

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Tue Oct 15 03:37:21 2019	(r353536)
+++ head/sys/vm/vm_page.c	Tue Oct 15 03:38:02 2019	(r353537)
@@ -1227,6 +1227,8 @@ vm_page_putfake(vm_page_t m)
 	KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed %p", m));
 	KASSERT((m->flags & PG_FICTITIOUS) != 0,
 	    ("vm_page_putfake: bad page %p", m));
+	if (vm_page_xbusied(m))
+		vm_page_xunbusy(m);
 	uma_zfree(fakepg_zone, m);
 }
 
@@ -1519,8 +1521,7 @@ vm_page_object_remove(vm_page_t m)
 	VM_OBJECT_ASSERT_WLOCKED(object);
 	KASSERT((m->ref_count & VPRC_OBJREF) != 0,
 	    ("page %p is missing its object ref", m));
-	if (vm_page_xbusied(m))
-		vm_page_xunbusy(m);
+
 	mrem = vm_radix_remove(&object->rtree, m->pindex);
 	KASSERT(mrem == m, ("removed page %p, expected page %p", mrem, m));
 
@@ -3590,7 +3591,7 @@ vm_page_free_prep(vm_page_t m)
 	VM_CNT_INC(v_tfree);
 
 	if (vm_page_sbusied(m))
-		panic("vm_page_free_prep: freeing busy page %p", m);
+		panic("vm_page_free_prep: freeing shared busy page %p", m);
 
 	if (m->object != NULL) {
 		vm_page_object_remove(m);
@@ -3606,6 +3607,9 @@ vm_page_free_prep(vm_page_t m)
 		m->object = NULL;
 		m->ref_count -= VPRC_OBJREF;
 	}
+
+	if (vm_page_xbusied(m))
+		vm_page_xunbusy(m);
 
 	/*
 	 * If fictitious remove object association and



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