summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-07-07 07:42:24 +0000
committerRichard Braun <rbraun@sceen.net>2012-07-07 08:07:42 +0000
commit2d2da4aad582bf1d63554cd9496285787db3e66e (patch)
treedda523827f0e24c61e488e98d4d24a0be6c32bdc
parent9c7d81dd1b033b112716916be37b8a8960f7413b (diff)
Merge kalloc_map into kmem_map
* ipc/ipc_table.c: Add #include <kern/slab.h>. (ipc_table_alloc): Use kmem_map instead of kalloc_map when allocating a table. (ipc_table_realloc): Likewise for reallocation. (ipc_table_free): Likewise for release. * kern/kalloc.h (kalloc_map): Remove declaration. * kern/slab.c (KMEM_MAP_SIZE): Increase to 128 MiB. (KALLOC_MAP_SIZE): Remove macro. (kalloc_map_store): Remove variable. (kalloc_map): Likewise. (kalloc_pagealloc): Use kmem_map instead of kalloc_map for general purpose allocations. (kalloc_pagefree): Likewise. (kalloc_init): Remove the creation of kalloc_map.
-rw-r--r--ipc/ipc_table.c7
-rw-r--r--kern/kalloc.h2
-rw-r--r--kern/slab.c21
3 files changed, 8 insertions, 22 deletions
diff --git a/ipc/ipc_table.c b/ipc/ipc_table.c
index d5b7904..cbb6a89 100644
--- a/ipc/ipc_table.c
+++ b/ipc/ipc_table.c
@@ -39,6 +39,7 @@
#include <ipc/ipc_port.h>
#include <ipc/ipc_entry.h>
#include <kern/kalloc.h>
+#include <kern/slab.h>
#include <vm/vm_kern.h>
/*
@@ -144,7 +145,7 @@ ipc_table_alloc(
if (size < PAGE_SIZE)
table = kalloc(size);
else
- if (kmem_alloc(kalloc_map, &table, size) != KERN_SUCCESS)
+ if (kmem_alloc(kmem_map, &table, size) != KERN_SUCCESS)
table = 0;
return table;
@@ -170,7 +171,7 @@ ipc_table_realloc(
{
vm_offset_t new_table;
- if (kmem_realloc(kalloc_map, old_table, old_size,
+ if (kmem_realloc(kmem_map, old_table, old_size,
&new_table, new_size) != KERN_SUCCESS)
new_table = 0;
@@ -194,5 +195,5 @@ ipc_table_free(
if (size < PAGE_SIZE)
kfree(table, size);
else
- kmem_free(kalloc_map, table, size);
+ kmem_free(kmem_map, table, size);
}
diff --git a/kern/kalloc.h b/kern/kalloc.h
index 1330b54..004e3a6 100644
--- a/kern/kalloc.h
+++ b/kern/kalloc.h
@@ -30,8 +30,6 @@
#include <mach/machine/vm_types.h>
#include <vm/vm_types.h>
-extern vm_map_t kalloc_map;
-
extern vm_offset_t kalloc (vm_size_t size);
extern void kfree (vm_offset_t data, vm_size_t size);
diff --git a/kern/slab.c b/kern/slab.c
index 5a9cbea..12e4ff4 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -165,7 +165,7 @@
/*
* Size of the VM submap from which default backend functions allocate.
*/
-#define KMEM_MAP_SIZE (64 * 1024 * 1024)
+#define KMEM_MAP_SIZE (128 * 1024 * 1024)
/*
* Shift for the first kalloc cache size.
@@ -178,11 +178,6 @@
#define KALLOC_NR_CACHES 13
/*
- * Size of the VM submap for general purpose allocations.
- */
-#define KALLOC_MAP_SIZE (64 * 1024 * 1024)
-
-/*
* Values the buftag state member can take.
*/
#ifdef __LP64__
@@ -283,18 +278,12 @@ static unsigned int kmem_nr_caches;
static simple_lock_data_t __attribute__((used)) kmem_cache_list_lock;
/*
- * VM submap for slab caches (except general purpose allocations).
+ * VM submap for slab caches.
*/
static struct vm_map kmem_map_store;
vm_map_t kmem_map = &kmem_map_store;
/*
- * VM submap for general purpose allocations.
- */
-static struct vm_map kalloc_map_store;
-vm_map_t kalloc_map = &kalloc_map_store;
-
-/*
* Time of the last memory reclaim, in clock ticks.
*/
static unsigned int kmem_gc_last_tick;
@@ -1380,7 +1369,7 @@ static vm_offset_t kalloc_pagealloc(vm_size_t size)
vm_offset_t addr;
kern_return_t kr;
- kr = kmem_alloc_wired(kalloc_map, &addr, size);
+ kr = kmem_alloc_wired(kmem_map, &addr, size);
if (kr != KERN_SUCCESS)
return 0;
@@ -1390,7 +1379,7 @@ static vm_offset_t kalloc_pagealloc(vm_size_t size)
static void kalloc_pagefree(vm_offset_t ptr, vm_size_t size)
{
- kmem_free(kalloc_map, ptr, size);
+ kmem_free(kmem_map, ptr, size);
}
void kalloc_init(void)
@@ -1399,8 +1388,6 @@ void kalloc_init(void)
size_t i, size;
vm_offset_t min, max;
- kmem_submap(kalloc_map, kernel_map, &min, &max, KALLOC_MAP_SIZE, FALSE);
-
size = 1 << KALLOC_FIRST_SHIFT;
for (i = 0; i < ARRAY_SIZE(kalloc_caches); i++) {