Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2017 16:55:44 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322970 - head/sys/vm
Message-ID:  <201708281655.v7SGtiO9039787@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Mon Aug 28 16:55:43 2017
New Revision: 322970
URL: https://svnweb.freebsd.org/changeset/base/322970

Log:
  Switching from a global hash table to per-vm_object radix tries for mapping
  vm_object page indices to on-disk swap space (r322913) has changed the
  synchronization requirements for a couple swap pager functions.  Whereas
  before a read lock on the vm object sufficed because of the global mutex
  on the hash table, a write lock on the vm object may now be required.  In
  particular, calls to vm_pager_page_unswapped() now require a write lock on
  the vm_object.  Consequently, vm_fault()'s fast path cannot call
  vm_pager_page_unswapped().  The swap space will have to be released at a
  later point.
  
  Reviewed by:	kib, markj
  X-MFC with:	r322913
  Differential Revision:	https://reviews.freebsd.org/D12134

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Mon Aug 28 15:54:07 2017	(r322969)
+++ head/sys/vm/vm_fault.c	Mon Aug 28 16:55:43 2017	(r322970)
@@ -236,14 +236,15 @@ vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_p
 	 * written NOW so dirty it explicitly to save on
 	 * pmap_is_modified() calls later.
 	 *
-	 * Also tell the backing pager, if any, that it should remove
-	 * any swap backing since the page is now dirty.
+	 * Also, since the page is now dirty, we can possibly tell
+	 * the pager to release any swap backing the page.  Calling
+	 * the pager requires a write lock on the object.
 	 */
 	if (need_dirty)
 		vm_page_dirty(m);
 	if (!set_wd)
 		vm_page_unlock(m);
-	if (need_dirty)
+	else if (need_dirty)
 		vm_pager_page_unswapped(m);
 }
 



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