alloc: reduce slabEntry size

This commit is contained in:
Mathieu Maret 2019-04-17 23:13:46 +02:00
parent b3d38d8c9c
commit 06c8562a80
2 changed files with 3 additions and 4 deletions

View File

@ -30,6 +30,8 @@ int allocInit(void)
} }
for (uint i = start; i <= SLUB_SIZE; i++) { for (uint i = start; i <= SLUB_SIZE; i++) {
if ((ret = allocBookSlab(1U << i, 0))) { if ((ret = allocBookSlab(1U << i, 0))) {
if(ret == -EEXIST)
continue;
pr_devel("Fail to allocBookSlab %d for %d \n", ret, (1U << i)); pr_devel("Fail to allocBookSlab %d for %d \n", ret, (1U << i));
return ret; return ret;
} }
@ -85,7 +87,6 @@ int addSlab(struct slabDesc **desc, size_t size, int selfContained)
list_singleton(slab, slab); list_singleton(slab, slab);
slab->page = (vaddr_t)alloc; slab->page = (vaddr_t)alloc;
slab->full = 0; slab->full = 0;
slab->size = size;
(*desc)->size = size; (*desc)->size = size;
// pr_devel("got page %d for size %d first %d", alloc, size, (*desc)->slab.freeEl); // pr_devel("got page %d for size %d first %d", alloc, size, (*desc)->slab.freeEl);
return formatPage(&(*desc)->slab, size, selfContained); return formatPage(&(*desc)->slab, size, selfContained);
@ -112,7 +113,6 @@ int addSlabEntry(struct slabEntry **desc, size_t size, int selfContained)
list_singleton(*desc, *desc); list_singleton(*desc, *desc);
(*desc)->page = (vaddr_t)alloc; (*desc)->page = (vaddr_t)alloc;
(*desc)->full = 0; (*desc)->full = 0;
(*desc)->size = size;
// pr_devel("got page %d for size %d first %d", alloc, size, (*desc)->freeEl); // pr_devel("got page %d for size %d first %d", alloc, size, (*desc)->freeEl);
return formatPage((*desc), size, selfContained); return formatPage((*desc), size, selfContained);
} }
@ -137,7 +137,7 @@ static void *allocFromSlab(struct slabEntry *slab)
{ {
vaddr_t *next = slab->freeEl; vaddr_t *next = slab->freeEl;
if (*next == (vaddr_t)NULL) { 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; slab->full = 1;
} else { } else {
slab->freeEl = (void *)(*next); slab->freeEl = (void *)(*next);

View File

@ -4,7 +4,6 @@
struct slabEntry { struct slabEntry {
vaddr_t page; vaddr_t page;
size_t size;
void *freeEl; void *freeEl;
char full; char full;
struct slabEntry *next; struct slabEntry *next;