mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:47:35 +00:00
Kernel: Convert RangeAllocator to using a RedBlackTree internally
This data structure is a much better fit for what is essentially a sorted list of non-overlapping ranges. Not using Vector means we no longer have to worry about Vector buffers getting huge. Only nice & small allocations from now on.
This commit is contained in:
parent
980f409003
commit
15ad4a8fd6
2 changed files with 42 additions and 42 deletions
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RedBlackTree.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/SpinLock.h>
|
||||
#include <Kernel/VM/Range.h>
|
||||
|
||||
|
@ -31,9 +31,9 @@ public:
|
|||
bool contains(Range const& range) const { return m_total_range.contains(range); }
|
||||
|
||||
private:
|
||||
void carve_at_index(int, Range const&);
|
||||
void carve_at_iterator(auto&, Range const&);
|
||||
|
||||
Vector<Range> m_available_ranges;
|
||||
RedBlackTree<FlatPtr, Range> m_available_ranges;
|
||||
Range m_total_range;
|
||||
mutable SpinLock<u8> m_lock;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue