mem: move slab min size to macro
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
parent
addf96aae7
commit
159ceec0a2
1 changed files with 5 additions and 5 deletions
|
|
@ -3,8 +3,9 @@
|
|||
#include <kernel/mem.h>
|
||||
#include <kernel/slab.h>
|
||||
|
||||
#define SLAB_MIN_COUNT 64
|
||||
#define SLAB_ALIGN 7
|
||||
#define SLAB_MIN_COUNT 256
|
||||
#define SLAB_MIN_SIZE 0x10000ull /* 64 KiB */
|
||||
#define SLAB_ALIGN 7 /* 8 byte alignment */
|
||||
|
||||
size_t slab_sizes[] = { 16, 32, 64, 128, 256, 512, 1024, 2048 };
|
||||
struct slab *slab_cache[ARRAY_SIZE(slab_sizes)];
|
||||
|
|
@ -28,7 +29,7 @@ struct slab *slab_create(size_t size)
|
|||
|
||||
/* account for slab header and eight bytes of alignment */
|
||||
size_t est = npow2(size * SLAB_MIN_COUNT + sizeof(struct slab) + 8);
|
||||
size_t asize = MAX(est, 0x1000ull);
|
||||
size_t asize = MAX(est, SLAB_MIN_SIZE);
|
||||
|
||||
struct slab *ret = buddy_alloc(asize);
|
||||
if (ret == NULL)
|
||||
|
|
@ -54,7 +55,6 @@ struct slab *slab_create(size_t size)
|
|||
}
|
||||
*(uintptr_t *)(start + ((ret->num - 1) * size)) = 0;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue