diff options
author | Richard Braun <rbraun@sceen.net> | 2017-01-11 21:31:53 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-01-11 21:31:53 +0100 |
commit | 135f428f0a50eb9988f0b40a60357dfedbcc7f18 (patch) | |
tree | 38eb76350879b55227295a2fa31c7bdaffae08f9 /kern/kmem.h | |
parent | 0a7bb2b9e2441cd0610a0687f39a38b5c66a6f46 (diff) |
kern/kmem: rework slab allocation
Allocating slabs from the page allocator only is likely to cause
fragmentation. Instead, allocate larger-than-page slabs from
kernel virtual memory, and page-sized slabs from the page allocator.
Diffstat (limited to 'kern/kmem.h')
-rw-r--r-- | kern/kmem.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kern/kmem.h b/kern/kmem.h index 3b2b49ae..b1861557 100644 --- a/kern/kmem.h +++ b/kern/kmem.h @@ -46,13 +46,14 @@ typedef void (*kmem_ctor_fn_t)(void *); * Cache creation flags. */ #define KMEM_CACHE_NOOFFSLAB 0x1 /* Don't allocate external slab data */ -#define KMEM_CACHE_VERIFY 0x2 /* Use debugging facilities */ +#define KMEM_CACHE_PAGE_ONLY 0x2 /* Allocate slabs from the page allocator */ +#define KMEM_CACHE_VERIFY 0x4 /* Use debugging facilities */ /* * Initialize a cache. * - * If a slab allocation/free function pointer is NULL, the default backend - * (vm_kmem on the kernel map) is used for the allocation/free action. + * Slabs may be allocated either from the page allocator or from kernel + * virtual memory, unless KMEM_CACHE_PAGE_ONLY is set. */ void kmem_cache_init(struct kmem_cache *cache, const char *name, size_t obj_size, size_t align, kmem_ctor_fn_t ctor, |