Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2019 15:16:48 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352411 - head/sys/vm
Message-ID:  <201909161516.x8GFGm40059900@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Sep 16 15:16:48 2019
New Revision: 352411
URL: https://svnweb.freebsd.org/changeset/base/352411

Log:
  Assert that the refcount value is not VPRC_BLOCKED in vm_page_drop().
  
  VPRC_BLOCKED is a refcount flag used to indicate that a thread is
  tearing down mappings of a page.  When set, it causes attempts to wire a
  page via a pmap lookup to fail.  It should never represent the last
  reference to a page, so assert this.
  
  Suggested by:	kib
  Reviewed by:	alc, kib
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D21639

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==============================================================================
--- head/sys/vm/vm_page.h	Mon Sep 16 15:12:49 2019	(r352410)
+++ head/sys/vm/vm_page.h	Mon Sep 16 15:16:48 2019	(r352411)
@@ -902,13 +902,17 @@ vm_page_in_laundry(vm_page_t m)
 static inline u_int
 vm_page_drop(vm_page_t m, u_int val)
 {
+	u_int old;
 
 	/*
 	 * Synchronize with vm_page_free_prep(): ensure that all updates to the
 	 * page structure are visible before it is freed.
 	 */
 	atomic_thread_fence_rel();
-	return (atomic_fetchadd_int(&m->ref_count, -val));
+	old = atomic_fetchadd_int(&m->ref_count, -val);
+	KASSERT(old != VPRC_BLOCKED,
+	    ("vm_page_drop: page %p has an invalid refcount value", m));
+	return (old);
 }
 
 /*



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