Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jun 2017 16:47:41 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320316 - head/sys/vm
Message-ID:  <201706241647.v5OGlfPn009252@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Jun 24 16:47:41 2017
New Revision: 320316
URL: https://svnweb.freebsd.org/changeset/base/320316

Log:
  Do not try to unmark MAP_ENTRY_IN_TRANSITION marked by other thread.
  
  The issue is catched by "vm_map_wire: alien wire" KASSERT at the end
  of the vm_map_wire().  We currently check for MAP_ENTRY_WIRE_SKIPPED
  flag before ensuring that the wiring_thread is curthread. For HOLESOK
  wiring, this means that we might see WIRE_SKIPPED entry from different
  wiring.
  
  The fix it by only checking WIRE_SKIPPED if the entry is put
  IN_TRANSITION by us.  Also fixed a typo in the comment explaining the
  situation.
  
  Reported and tested by:	pho
  Reviewed by:	alc
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Sat Jun 24 16:41:26 2017	(r320315)
+++ head/sys/vm/vm_map.c	Sat Jun 24 16:47:41 2017	(r320316)
@@ -2712,9 +2712,6 @@ done:
 	}
 	for (entry = first_entry; entry != &map->header && entry->start < end;
 	    entry = entry->next) {
-		if ((entry->eflags & MAP_ENTRY_WIRE_SKIPPED) != 0)
-			goto next_entry_done;
-
 		/*
 		 * If VM_MAP_WIRE_HOLESOK was specified, an empty
 		 * space in the unwired region could have been mapped
@@ -2722,7 +2719,7 @@ done:
 		 * pages or draining MAP_ENTRY_IN_TRANSITION.
 		 * Moreover, another thread could be simultaneously
 		 * wiring this new mapping entry.  Detect these cases
-		 * and skip any entries marked as in transition by us.
+		 * and skip any entries marked as in transition not by us.
 		 */
 		if ((entry->eflags & MAP_ENTRY_IN_TRANSITION) == 0 ||
 		    entry->wiring_thread != curthread) {
@@ -2730,6 +2727,9 @@ done:
 			    ("vm_map_wire: !HOLESOK and new/changed entry"));
 			continue;
 		}
+
+		if ((entry->eflags & MAP_ENTRY_WIRE_SKIPPED) != 0)
+			goto next_entry_done;
 
 		if (rv == KERN_SUCCESS) {
 			if (user_wire)



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