1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

Kernel: Take the RegionTree spinlock when inspecting tree from outside

This patch adds RegionTree::get_lock() which exposes the internal lock
inside RegionTree. We can then lock it from the outside when doing
lookups or traversal.

This solution is not very beautiful, we should find a way to protect
this data with SpinlockProtected or something similar. This is a stopgap
patch to try and fix the currently flaky CI.
This commit is contained in:
Andreas Kling 2022-04-05 01:07:23 +02:00
parent e3e1d79a7d
commit f0f97e1db0
4 changed files with 21 additions and 3 deletions

View file

@ -49,12 +49,15 @@ public:
void delete_all_regions_assuming_they_are_unmapped();
// FIXME: Access the region tree through a SpinlockProtected or similar.
RecursiveSpinlock& get_lock() const { return m_lock; }
private:
ErrorOr<VirtualRange> allocate_range_anywhere(size_t size, size_t alignment = PAGE_SIZE);
ErrorOr<VirtualRange> allocate_range_specific(VirtualAddress base, size_t size);
ErrorOr<VirtualRange> allocate_range_randomized(size_t size, size_t alignment = PAGE_SIZE);
Spinlock m_lock;
RecursiveSpinlock mutable m_lock;
IntrusiveRedBlackTree<&Region::m_tree_node> m_regions;
VirtualRange const m_total_range;