svn commit: r364768 - head/sys/vm

Mark Johnston markj at FreeBSD.org
Tue Aug 25 13:45:07 UTC 2020


Author: markj
Date: Tue Aug 25 13:45:06 2020
New Revision: 364768
URL: https://svnweb.freebsd.org/changeset/base/364768

Log:
  Permit vm_page_wire() to be called on pages not belonging to an object.
  
  For such pages ref_count is effectively a consumer-managed field, but
  there is no harm in calling vm_page_wire() on them.
  vm_page_unwire_noq() handles them as well.  Relax the vm_page_wire()
  assertions to permit this case which is triggered by some out-of-tree
  code. [1]
  
  Also guard a conditional assertion with INVARIANTS.  Otherwise the
  conditions are evaluated even though the result is unused. [2]
  
  Reported by:	bz, cem [1], kib [2]
  Reviewed by:	dougm, kib
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D26173

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Tue Aug 25 13:30:34 2020	(r364767)
+++ head/sys/vm/vm_page.c	Tue Aug 25 13:45:06 2020	(r364768)
@@ -3854,18 +3854,19 @@ vm_page_free_pages_toq(struct spglist *free, bool upda
 }
 
 /*
- * Mark this page as wired down, preventing reclamation by the page daemon
- * or when the containing object is destroyed.
+ * Mark this page as wired down.  For managed pages, this prevents reclamation
+ * by the page daemon, or when the containing object, if any, is destroyed.
  */
 void
 vm_page_wire(vm_page_t m)
 {
 	u_int old;
 
-	KASSERT(m->object != NULL,
-	    ("vm_page_wire: page %p does not belong to an object", m));
-	if (!vm_page_busied(m) && !vm_object_busied(m->object))
+#ifdef INVARIANTS
+	if (m->object != NULL && !vm_page_busied(m) &&
+	    !vm_object_busied(m->object))
 		VM_OBJECT_ASSERT_LOCKED(m->object);
+#endif
 	KASSERT((m->flags & PG_FICTITIOUS) == 0 ||
 	    VPRC_WIRE_COUNT(m->ref_count) >= 1,
 	    ("vm_page_wire: fictitious page %p has zero wirings", m));


More information about the svn-src-all mailing list