heap: Quality updates to heap management
- Allow reuse of unused sections that fit exactly to selected allocation size. Decreases fragmentation dramatically. - Always allocate and align mapped memory to selected alignment. Avoids having fragmented unused maps that are not aligned. - Use a static alignment based on BPMP and generally average cache line size. Boosts performance when MMU is used.
This commit is contained in:
@@ -25,6 +25,7 @@ typedef struct _hnode
|
||||
u32 size;
|
||||
struct _hnode *prev;
|
||||
struct _hnode *next;
|
||||
u32 align[4]; // Align to arch cache line size.
|
||||
} hnode_t;
|
||||
|
||||
typedef struct _heap
|
||||
@@ -32,3 +33,9 @@ typedef struct _heap
|
||||
u32 start;
|
||||
hnode_t *first;
|
||||
} heap_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 total;
|
||||
u32 used;
|
||||
} heap_monitor_t;
|
||||
|
||||
Reference in New Issue
Block a user