Author: alc
Date: Sat Jul 28 04:06:33 2018
New Revision: 336803
URL: https://svnweb.freebsd.org/changeset/base/336803

Log:
  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

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c        Sat Jul 28 02:53:36 2018        (r336802)
+++ head/sys/vm/vm_map.c        Sat Jul 28 04:06:33 2018        (r336803)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to