theseus-os/Theseus

page_allocator: use `RbTree`'s `Entry` API for deallocation

kevinaboos opened this issue · 0 comments

Rather than always inserting a new Chunk for a dropped AllocatedPages, we should use the Entry API instead, which is faster and allows for basically free checks to see if we can eagerly merge the deallocated pages with an existing chunk of pages. This is "free" because it would add no additional overhead beyond inserting a new chunk. In fact, in the case of being able to merge with an existing (contiguously-adjacent) free chunk, it would be significantly faster because no heap allocation would be required for the new chunk.

Relevant code:

let res = locked_list.insert(Chunk {