svn commit: r336030 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Fri Jul 6 12:44:49 UTC 2018


Author: kib
Date: Fri Jul  6 12:44:48 2018
New Revision: 336030
URL: https://svnweb.freebsd.org/changeset/base/336030

Log:
  Save a call to pmap_remove() if entry cannot have any pages mapped.
  
  Due to the way rtld creates mappings for the shared objects, each dso
  causes unmap of at least three guard map entries.  For instance, in
  the buildworld load, this change reduces the amount of pmap_remove()
  calls by 1/5.
  
  Profiled by:	alc
  Reviewed by:	alc, markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D16148

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Fri Jul  6 12:37:46 2018	(r336029)
+++ head/sys/vm/vm_map.c	Fri Jul  6 12:44:48 2018	(r336030)
@@ -3158,7 +3158,14 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs
 		if (entry->wired_count != 0)
 			vm_map_entry_unwire(map, entry);
 
-		pmap_remove(map->pmap, entry->start, entry->end);
+		/*
+		 * Remove mappings for the pages, but only if the
+		 * mappings could exist.  For instance, it does not
+		 * make sense to call pmap_remove() for guard entries.
+		 */
+		if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0 ||
+		    entry->object.vm_object != NULL)
+			pmap_remove(map->pmap, entry->start, entry->end);
 
 		/*
 		 * Delete the entry only after removing all pmap


More information about the svn-src-head mailing list