summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2016-08-05 15:00:07 +0200
committerRichard Braun <rbraun@sceen.net>2016-08-06 00:09:56 +0200
commitbc23dda642a299fb1380294f4e5940511bc512ef (patch)
tree2009cfe49bc974f36a7ce155a255aaf95ce281b7 /vm
parent4bccd10cfeaf126382467dd90d7339a98989b9d2 (diff)
Augment VM maps with task names
This change improves the clarity of "no more room for ..." VM map allocation errors. * kern/task.c (task_init): Call vm_map_set_name for the kernel map. (task_create): Call vm_map_set_name where appropriate. * vm/vm_map.c (vm_map_setup): Set map name to NULL. (vm_map_find_entry_anywhere): Update error message to include map name. * vm/vm_map.h (struct vm_map): New `name' member. (vm_map_set_name): New inline function.
Diffstat (limited to 'vm')
-rw-r--r--vm/vm_map.c3
-rw-r--r--vm/vm_map.h8
2 files changed, 10 insertions, 1 deletions
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 4490878d..ccbe8f1a 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -195,6 +195,7 @@ void vm_map_setup(
map->wait_for_space = FALSE;
map->first_free = vm_map_to_entry(map);
map->hint = vm_map_to_entry(map);
+ map->name = NULL;
vm_map_lock_init(map);
simple_lock_init(&map->ref_lock);
simple_lock_init(&map->hint_lock);
@@ -704,7 +705,7 @@ restart:
return entry;
error:
- printf("no more room in %p\n", map);
+ printf("no more room in %p (%s)\n", map, map->name);
return NULL;
}
diff --git a/vm/vm_map.h b/vm/vm_map.h
index 74c86a79..9e946c5e 100644
--- a/vm/vm_map.h
+++ b/vm/vm_map.h
@@ -194,6 +194,8 @@ struct vm_map {
/* boolean_t */ wiring_required:1; /* All memory wired? */
unsigned int timestamp; /* Version number */
+
+ const char *name; /* Associated name */
};
#define vm_map_to_entry(map) ((struct vm_map_entry *) &(map)->hdr.links)
@@ -466,6 +468,12 @@ boolean_t vm_map_lookup_entry(
vm_offset_t address,
vm_map_entry_t *entry); /* OUT */
+static inline void vm_map_set_name(vm_map_t map, const char *name)
+{
+ map->name = name;
+}
+
+
/*
* Functions implemented as macros
*/