don't merge incompatible map entries. eg. private and shared.
This commit is contained in:
parent
097f0ea734
commit
592c954dc7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uvm_map.c,v 1.175 2005/01/01 21:02:13 yamt Exp $ */
|
||||
/* $NetBSD: uvm_map.c,v 1.176 2005/01/01 21:11:51 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.175 2005/01/01 21:02:13 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.176 2005/01/01 21:11:51 yamt Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_uvmhist.h"
|
||||
|
@ -937,6 +937,7 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
|
|||
const int kmap = (vm_map_pmap(map) == pmap_kernel());
|
||||
int merged = 0;
|
||||
int error;
|
||||
int newetype;
|
||||
|
||||
UVMHIST_FUNC("uvm_map_enter");
|
||||
UVMHIST_CALLED(maphist);
|
||||
|
@ -950,6 +951,17 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
|
|||
KASSERT(new_entry->flags & UVM_MAP_QUANTUM);
|
||||
}
|
||||
|
||||
if (uobj)
|
||||
newetype = UVM_ET_OBJ;
|
||||
else
|
||||
newetype = 0;
|
||||
|
||||
if (flags & UVM_FLAG_COPYONW) {
|
||||
newetype |= UVM_ET_COPYONWRITE;
|
||||
if ((flags & UVM_FLAG_OVERLAY) == 0)
|
||||
newetype |= UVM_ET_NEEDSCOPY;
|
||||
}
|
||||
|
||||
/*
|
||||
* try and insert in map by extending previous entry, if possible.
|
||||
* XXX: we don't try and pull back the next entry. might be useful
|
||||
|
@ -959,7 +971,8 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
|
|||
if (flags & UVM_FLAG_NOMERGE)
|
||||
goto nomerge;
|
||||
|
||||
if (prev_entry->end == start &&
|
||||
if (prev_entry->etype == newetype &&
|
||||
prev_entry->end == start &&
|
||||
prev_entry != &map->header &&
|
||||
prev_entry->object.uvm_obj == uobj) {
|
||||
|
||||
|
@ -970,9 +983,6 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
|
|||
(prev_entry->end - prev_entry->start) != uoffset)
|
||||
goto forwardmerge;
|
||||
|
||||
if (UVM_ET_ISSUBMAP(prev_entry))
|
||||
goto forwardmerge;
|
||||
|
||||
if (prev_entry->protection != prot ||
|
||||
prev_entry->max_protection != maxprot)
|
||||
goto forwardmerge;
|
||||
|
@ -1027,7 +1037,8 @@ uvm_map_enter(struct vm_map *map, const struct uvm_map_args *args,
|
|||
}
|
||||
|
||||
forwardmerge:
|
||||
if (prev_entry->next->start == (start + size) &&
|
||||
if (prev_entry->next->etype == newetype &&
|
||||
prev_entry->next->start == (start + size) &&
|
||||
prev_entry->next != &map->header &&
|
||||
prev_entry->next->object.uvm_obj == uobj) {
|
||||
|
||||
|
@ -1037,9 +1048,6 @@ forwardmerge:
|
|||
if (uobj && prev_entry->next->offset != uoffset + size)
|
||||
goto nomerge;
|
||||
|
||||
if (UVM_ET_ISSUBMAP(prev_entry->next))
|
||||
goto nomerge;
|
||||
|
||||
if (prev_entry->next->protection != prot ||
|
||||
prev_entry->next->max_protection != maxprot)
|
||||
goto nomerge;
|
||||
|
@ -1197,16 +1205,8 @@ nomerge:
|
|||
new_entry->object.uvm_obj = uobj;
|
||||
new_entry->offset = uoffset;
|
||||
|
||||
if (uobj)
|
||||
new_entry->etype = UVM_ET_OBJ;
|
||||
else
|
||||
new_entry->etype = 0;
|
||||
new_entry->etype = newetype;
|
||||
|
||||
if (flags & UVM_FLAG_COPYONW) {
|
||||
new_entry->etype |= UVM_ET_COPYONWRITE;
|
||||
if ((flags & UVM_FLAG_OVERLAY) == 0)
|
||||
new_entry->etype |= UVM_ET_NEEDSCOPY;
|
||||
}
|
||||
if (flags & UVM_FLAG_NOMERGE) {
|
||||
new_entry->flags |= UVM_MAP_NOMERGE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue