svn commit: r301210 - head/sys/vm

Mark Johnston markj at FreeBSD.org
Thu Jun 2 16:58:49 UTC 2016


Author: markj
Date: Thu Jun  2 16:58:47 2016
New Revision: 301210
URL: https://svnweb.freebsd.org/changeset/base/301210

Log:
  Don't preserve the page's object linkage in vm_page_insert_after().
  
  Per the KASSERT at the beginning of the function, we expect that the page
  does not belong to any object, so its object and pindex fields are
  meaningless. Reset them in the rare case that vm_radix_insert() fails.
  
  Reviewed by:	kib
  MFC after:	1 week
  Differential Revision: https://reviews.freebsd.org/D6669

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Thu Jun  2 16:40:09 2016	(r301209)
+++ head/sys/vm/vm_page.c	Thu Jun  2 16:58:47 2016	(r301210)
@@ -1112,8 +1112,6 @@ static int
 vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex,
     vm_page_t mpred)
 {
-	vm_pindex_t sidx;
-	vm_object_t sobj;
 	vm_page_t msucc;
 
 	VM_OBJECT_ASSERT_WLOCKED(object);
@@ -1134,8 +1132,6 @@ vm_page_insert_after(vm_page_t m, vm_obj
 	/*
 	 * Record the object/offset pair in this page
 	 */
-	sobj = m->object;
-	sidx = m->pindex;
 	m->object = object;
 	m->pindex = pindex;
 
@@ -1143,8 +1139,8 @@ vm_page_insert_after(vm_page_t m, vm_obj
 	 * Now link into the object's ordered list of backed pages.
 	 */
 	if (vm_radix_insert(&object->rtree, m)) {
-		m->object = sobj;
-		m->pindex = sidx;
+		m->object = NULL;
+		m->pindex = 0;
 		return (1);
 	}
 	vm_page_insert_radixdone(m, object, mpred);


More information about the svn-src-head mailing list