diff options
author | Maria Matejka <mq@ucw.cz> | 2021-11-30 23:57:14 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-12-01 13:00:54 +0100 |
commit | bb63e99d7877023667edaf26495dd657ec2fd57b (patch) | |
tree | 3ae919a00541c27c8f661addb56c6d4ef681d361 /lib/slab.c | |
parent | 385b3ea3956aefc2868cdd838fc0a90f1d8a7857 (diff) |
Page allocator moved from pools to IO loops.
The resource pool system is highly hierarchical and keeping spare pages
in pools leads to unnecessarily complex memory management.
Loops have a flat hiearchy, at least for now, and it is therefore much
easier to keep care of pages, especially in cases of excessive virtual memory
fragmentation.
Diffstat (limited to 'lib/slab.c')
-rw-r--r-- | lib/slab.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -269,7 +269,7 @@ no_partial: s->num_empty_heads--; goto okay; } - h = alloc_page(s->p); + h = alloc_page(); #ifdef POISON memset(h, 0xba, page_size); #endif @@ -332,7 +332,7 @@ sl_free(slab *s, void *oo) #ifdef POISON memset(h, 0xde, page_size); #endif - free_page(s->p, h); + free_page(h); } else { @@ -349,11 +349,11 @@ slab_free(resource *r) struct sl_head *h, *g; WALK_LIST_DELSAFE(h, g, s->empty_heads) - free_page(s->p, h); + free_page(h); WALK_LIST_DELSAFE(h, g, s->partial_heads) - free_page(s->p, h); + free_page(h); WALK_LIST_DELSAFE(h, g, s->full_heads) - free_page(s->p, h); + free_page(h); } static void @@ -386,8 +386,7 @@ slab_memsize(resource *r) WALK_LIST(h, s->full_heads) heads++; -// return ALLOC_OVERHEAD + sizeof(struct slab) + heads * (ALLOC_OVERHEAD + page_size); - return ALLOC_OVERHEAD + sizeof(struct slab); /* The page sizes are accounted for in the pool */ + return ALLOC_OVERHEAD + sizeof(struct slab) + heads * page_size; } static resource * |