-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slab allocator: fixes/enhancements in slab allocator
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:- - During allocation if meta_slab_t is not available then allocator will do - Allocate a fresh page - First entry is special meta_slab_t in this page - First entry will treat rest of meta_slab_t entries in page as normal meta_slab_t entry to allocate user requested memory allocations. - Link special meta_slab_t entry in a global list so that all such allocated 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]>
- Loading branch information
1 parent
7ee6fb8
commit 1638f4f
Showing
2 changed files
with
145 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters