1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:27:45 +00:00

Kernel: Use find_largest_not_above in VirtualRangeAllocator

Instead of iterating over the regions in the tree which is O(n), we can
just use RedBlackTree's find_largest_not_above method, which is O(logn)
This commit is contained in:
Idan Horowitz 2021-10-07 22:55:34 +03:00 committed by Andreas Kling
parent 49259777ef
commit 4174fe0156
2 changed files with 14 additions and 15 deletions

View file

@ -31,7 +31,7 @@ public:
bool contains(VirtualRange const& range) const { return m_total_range.contains(range); }
private:
void carve_at_iterator(auto&, VirtualRange const&);
void carve_from_region(VirtualRange const& from, VirtualRange const&);
RedBlackTree<FlatPtr, VirtualRange> m_available_ranges;
VirtualRange m_total_range;