Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108613388
D47934.id147552.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D47934.id147552.diff
View Options
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -620,7 +620,7 @@
* handling for sv_minuser here, like is done for exec_new_vmspace().
*/
vm_map_init(&vmspace0.vm_map, vmspace_pmap(&vmspace0),
- p->p_sysent->sv_minuser, p->p_sysent->sv_maxuser);
+ p->p_sysent->sv_minuser, p->p_sysent->sv_maxuser, false);
/*
* Call the init and ctor for the new thread and proc. We wait
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -455,7 +455,7 @@
if (ret != KERN_SUCCESS)
panic("kmem_subinit: bad status return of %d", ret);
*max = *min + size;
- vm_map_init(map, vm_map_pmap(parent), *min, *max);
+ vm_map_init(map, vm_map_pmap(parent), *min, *max, false);
if (vm_map_submap(parent, *min, *max, map) != KERN_SUCCESS)
panic("kmem_subinit: unable to change range to submap");
}
@@ -830,8 +830,7 @@
vm_size_t quantum;
int domain;
- vm_map_init(kernel_map, kernel_pmap, VM_MIN_KERNEL_ADDRESS, end);
- kernel_map->system_map = 1;
+ vm_map_init(kernel_map, kernel_pmap, VM_MIN_KERNEL_ADDRESS, end, true);
vm_map_lock(kernel_map);
/* N.B.: cannot use kgdb to debug, starting with this assignment ... */
(void)vm_map_insert(kernel_map, NULL, 0,
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -203,8 +203,10 @@
*/
struct vm_map {
struct vm_map_entry header; /* List of entries */
- struct sx lock; /* Lock for map data */
- struct mtx system_mtx;
+ union {
+ struct sx lock; /* Lock for map data */
+ struct mtx system_mtx;
+ };
int nentries; /* Number of entries */
vm_size_t size; /* virtual size */
u_int timestamp; /* Version number */
@@ -483,7 +485,7 @@
vm_prot_t, vm_prot_t, int);
vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);
-void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t);
+void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t, bool);
int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int);
int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *,
vm_pindex_t *, vm_prot_t *, boolean_t *);
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -126,7 +126,7 @@
static uma_zone_t vmspace_zone;
static int vmspace_zinit(void *mem, int size, int flags);
static void _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min,
- vm_offset_t max);
+ vm_offset_t max, bool system_map);
static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t system_map);
static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry);
static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry);
@@ -293,8 +293,6 @@
map = &vm->vm_map;
memset(map, 0, sizeof(*map));
- mtx_init(&map->system_mtx, "vm map (system)", NULL,
- MTX_DEF | MTX_DUPOK);
sx_init(&map->lock, "vm map (user)");
PMAP_LOCK_INIT(vmspace_pmap(vm));
return (0);
@@ -330,7 +328,7 @@
return (NULL);
}
CTR1(KTR_VM, "vmspace_alloc: %p", vm);
- _vm_map_init(&vm->vm_map, vmspace_pmap(vm), min, max);
+ _vm_map_init(&vm->vm_map, vmspace_pmap(vm), min, max, false);
refcount_init(&vm->vm_refcnt, 1);
vm->vm_shm = NULL;
vm->vm_swrss = 0;
@@ -885,12 +883,13 @@
* such as that in the vmspace structure.
*/
static void
-_vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max)
+_vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max,
+ bool system_map)
{
map->header.eflags = MAP_ENTRY_HEADER;
map->needs_wakeup = FALSE;
- map->system_map = 0;
+ map->system_map = system_map;
map->pmap = pmap;
map->header.end = min;
map->header.start = max;
@@ -906,13 +905,16 @@
}
void
-vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max)
+vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max,
+ bool system_map)
{
- _vm_map_init(map, pmap, min, max);
- mtx_init(&map->system_mtx, "vm map (system)", NULL,
- MTX_DEF | MTX_DUPOK);
- sx_init(&map->lock, "vm map (user)");
+ _vm_map_init(map, pmap, min, max, system_map);
+ if (system_map)
+ mtx_init(&map->system_mtx, "vm map (system)", NULL,
+ MTX_DEF | MTX_DUPOK);
+ else
+ sx_init(&map->lock, "vm map (user)");
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 9:39 PM (8 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16214043
Default Alt Text
D47934.id147552.diff (4 KB)
Attached To
Mode
D47934: vm_map: overlap system map mutex and user man sx
Attached
Detach File
Event Timeline
Log In to Comment