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
This commit is contained in:
Konstantin Belousov 2018-07-06 12:44:48 +00:00
parent be7be41275
commit 32f0fefc39
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336030

View File

@ -3158,7 +3158,14 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end)
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