From 724326b4d590d94ff81eb2e5817cc79a9bade7e4 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Mon, 22 Feb 2016 21:59:07 +0100 Subject: Fix slab allocator option handling The slab allocator has grown to use multiple ways to allocate slabs as well as track them, which got a little messy. One consequence is the breaking of the KMEM_CF_VERIFY option. In order to make the code less confusing, this change expresses all options as explicit cache flags and clearly defines their relationships. The special kmem_slab and vm_map_entry caches are initialized accordingly. * kern/slab.c (KMEM_CF_DIRECTMAP): Rename to ... (KMEM_CF_PHYSMEM): ... this new macro. (KMEM_CF_DIRECT): Restore macro. (KMEM_CF_USE_TREE, KMEM_CF_USE_PAGE): New macros. (KMEM_CF_VERIFY): Update value. (kmem_pagealloc_directmap): Rename to... (kmem_pagealloc_physmem): ... this new function. (kmem_pagefree_directmap): Rename to ... (kmem_pagefree_physmem): ... this new function. (kmem_pagealloc, kmem_pagefree): Update macro names. (kmem_slab_use_tree): Remove function. (kmem_slab_create, kmem_slab_destroy): Update according to the new cache flags. (kmem_cache_compute_sizes): Rename to ... (kmem_cache_compute_properties): ... this new function, and update to properly set cache flags. (kmem_cache_init): Update call to kmem_cache_compute_properties. (kmem_cache_alloc_from_slab): Check KMEM_CF_USE_TREE instead of calling the defunct kmem_slab_use_tree function. (kmem_cache_free_to_slab): Update according to the new cache flags. kmem_cache_free_verify): Add assertion. (slab_init): Update initialization of kmem_slab_cache. * kern/slab.h (KMEM_CACHE_DIRECTMAP): Rename to ... (KMEM_CACHE_PHYSMEM): ... this new macro. * vm/vm_map.c (vm_map_init): Update initialization of vm_map_entry_cache. --- kern/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kern/slab.h') diff --git a/kern/slab.h b/kern/slab.h index a9978fdb..8527c9db 100644 --- a/kern/slab.h +++ b/kern/slab.h @@ -196,7 +196,7 @@ typedef struct kmem_cache *kmem_cache_t; * Cache initialization flags. */ #define KMEM_CACHE_NOOFFSLAB 0x1 /* Don't allocate external slab data */ -#define KMEM_CACHE_DIRECTMAP 0x2 /* Allocate from physical memory */ +#define KMEM_CACHE_PHYSMEM 0x2 /* Allocate from physical memory */ #define KMEM_CACHE_VERIFY 0x4 /* Use debugging facilities */ /* -- cgit v1.2.3