From 737e25f7ebe94c8262c7d420d339148a27127e99 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 28 Jul 2018 04:06:33 +0000 Subject: [PATCH] To date, mlockall(MCL_FUTURE) has had the unfortunate side effect of blocking vm map entry and object coalescing for the calling process. However, there is no reason that mlockall(MCL_FUTURE) should block such coalescing. This change enables it. Reviewed by: kib, markj Tested by: pho MFC after: 6 weeks Differential Revision: https://reviews.freebsd.org/D16413 --- sys/vm/vm_map.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 97162082dd0b..c2a7128137a2 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1277,10 +1277,9 @@ charged: vm_object_clear_flag(object, OBJ_ONEMAPPING); VM_OBJECT_WUNLOCK(object); } else if (prev_entry != &map->header && - prev_entry->eflags == protoeflags && + (prev_entry->eflags & ~MAP_ENTRY_USER_WIRED) == protoeflags && (cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP)) == 0 && - prev_entry->end == start && prev_entry->wired_count == 0 && - (prev_entry->cred == cred || + prev_entry->end == start && (prev_entry->cred == cred || (prev_entry->object.vm_object != NULL && prev_entry->object.vm_object->cred == cred)) && vm_object_coalesce(prev_entry->object.vm_object, @@ -1295,7 +1294,11 @@ charged: */ if (prev_entry->inheritance == inheritance && prev_entry->protection == prot && - prev_entry->max_protection == max) { + prev_entry->max_protection == max && + prev_entry->wired_count == 0) { + KASSERT((prev_entry->eflags & MAP_ENTRY_USER_WIRED) == + 0, ("prev_entry %p has incoherent wiring", + prev_entry)); if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0) map->size += end - prev_entry->end; prev_entry->end = end;