uvm_map_enter: don't bother to defer amap allocation if there's a mergable

existing entry.  although there're merits and demerits, i think it benefits
common cases.
This commit is contained in:
yamt 2005-04-29 09:05:21 +00:00
parent 82a05c7f12
commit 9aacd16106
1 changed files with 12 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.189 2005/04/28 14:40:43 yamt Exp $ */
/* $NetBSD: uvm_map.c,v 1.190 2005/04/29 09:05:21 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.189 2005/04/28 14:40:43 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.190 2005/04/29 09:05:21 yamt Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@ -1010,14 +1010,17 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
if (flags & UVM_FLAG_NOMERGE)
goto nomerge;
if (prev_entry->etype == newetype &&
prev_entry->end == start &&
if (prev_entry->end == start &&
prev_entry != &map->header &&
prev_entry->object.uvm_obj == uobj) {
if ((prev_entry->flags & meflagmask) != meflagval)
goto forwardmerge;
if (prev_entry->etype != newetype &&
(prev_entry->etype | UVM_ET_NEEDSCOPY) != newetype)
goto forwardmerge;
if (uobj && prev_entry->offset +
(prev_entry->end - prev_entry->start) != uoffset)
goto forwardmerge;
@ -1076,14 +1079,17 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
}
forwardmerge:
if (prev_entry->next->etype == newetype &&
prev_entry->next->start == (start + size) &&
if (prev_entry->next->start == (start + size) &&
prev_entry->next != &map->header &&
prev_entry->next->object.uvm_obj == uobj) {
if ((prev_entry->next->flags & meflagmask) != meflagval)
goto nomerge;
if (prev_entry->next->etype != newetype &&
(prev_entry->next->etype | UVM_ET_NEEDSCOPY) != newetype)
goto nomerge;
if (uobj && prev_entry->next->offset != uoffset + size)
goto nomerge;