alloc: reduce slabEntry size
This commit is contained in:
parent
b3d38d8c9c
commit
06c8562a80
@ -30,6 +30,8 @@ int allocInit(void)
|
||||
}
|
||||
for (uint i = start; i <= SLUB_SIZE; i++) {
|
||||
if ((ret = allocBookSlab(1U << i, 0))) {
|
||||
if(ret == -EEXIST)
|
||||
continue;
|
||||
pr_devel("Fail to allocBookSlab %d for %d \n", ret, (1U << i));
|
||||
return ret;
|
||||
}
|
||||
@ -85,7 +87,6 @@ int addSlab(struct slabDesc **desc, size_t size, int selfContained)
|
||||
list_singleton(slab, slab);
|
||||
slab->page = (vaddr_t)alloc;
|
||||
slab->full = 0;
|
||||
slab->size = size;
|
||||
(*desc)->size = size;
|
||||
// pr_devel("got page %d for size %d first %d", alloc, size, (*desc)->slab.freeEl);
|
||||
return formatPage(&(*desc)->slab, size, selfContained);
|
||||
@ -112,7 +113,6 @@ int addSlabEntry(struct slabEntry **desc, size_t size, int selfContained)
|
||||
list_singleton(*desc, *desc);
|
||||
(*desc)->page = (vaddr_t)alloc;
|
||||
(*desc)->full = 0;
|
||||
(*desc)->size = size;
|
||||
// pr_devel("got page %d for size %d first %d", alloc, size, (*desc)->freeEl);
|
||||
return formatPage((*desc), size, selfContained);
|
||||
}
|
||||
@ -137,7 +137,7 @@ static void *allocFromSlab(struct slabEntry *slab)
|
||||
{
|
||||
vaddr_t *next = slab->freeEl;
|
||||
if (*next == (vaddr_t)NULL) {
|
||||
pr_devel("Slab @%d for %d is now full\n", slab, slab->size);
|
||||
pr_devel("Slab @%d is now full\n", slab);
|
||||
slab->full = 1;
|
||||
} else {
|
||||
slab->freeEl = (void *)(*next);
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
struct slabEntry {
|
||||
vaddr_t page;
|
||||
size_t size;
|
||||
void *freeEl;
|
||||
char full;
|
||||
struct slabEntry *next;
|
||||
|
Loading…
Reference in New Issue
Block a user