slab allocator: fixes/enhancements in slab allocator #236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes:
When we first implemented slab allocator for KTF, we never cared for freeing
memory when entire slab is freed up. Reason being we thought of it as short-
running kernel. However we're into a situation where we're allocating a lot of
memory, thanks for integration of external library doing malloc and free.
This change ensures that if a slab got completly freed up, we free up the memory
and put that meta slab back into free list.
Added a spinlock around allocation, free and initialization
Enhancement:
slab allocator was limited in the sense that it wouldn't allocate more if
meta_slab_t entries contained in globally allocated page at initializaiton
were all exhausted. This change makes a slight design change as follows:-
meta_slab_t entry to allocate user requested memory allocations.
pages are linked together
Note about special meta_slab_t entry:-
Special meta_slab_t is basically to manage meta_slab_t entries itself. It's metadata
of metadata of user allocations.
Signed-off-by: dkgupta [email protected]