svn commit: r320316 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Sat Jun 24 16:47:42 UTC 2017


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)


More information about the svn-src-head mailing list