summaryrefslogtreecommitdiff
path: root/Kernel/VM/RangeAllocator.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-10-31 17:12:23 -0600
committerAndreas Kling <kling@serenityos.org>2020-11-11 12:27:25 +0100
commit2b25a89ab5625b1dd04b10f76b447177fd294f53 (patch)
tree2ea23c9b19a9164f5de99eb9795c6c69de4892fb /Kernel/VM/RangeAllocator.h
parent66f46d03e4aeb5fe77098db73f275ddab3cfde8c (diff)
downloadserenity-2b25a89ab5625b1dd04b10f76b447177fd294f53.zip
Kernel: Add locks around RangeAllocator
We need to keep multiple processors from changing it at the same time.
Diffstat (limited to 'Kernel/VM/RangeAllocator.h')
-rw-r--r--Kernel/VM/RangeAllocator.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/VM/RangeAllocator.h b/Kernel/VM/RangeAllocator.h
index a5fe6ad893..964139c475 100644
--- a/Kernel/VM/RangeAllocator.h
+++ b/Kernel/VM/RangeAllocator.h
@@ -29,6 +29,7 @@
#include <AK/String.h>
#include <AK/Traits.h>
#include <AK/Vector.h>
+#include <Kernel/SpinLock.h>
#include <Kernel/VirtualAddress.h>
namespace Kernel {
@@ -92,6 +93,7 @@ public:
bool contains(const Range& range) const
{
+ ScopedSpinLock lock(m_lock);
return m_total_range.contains(range);
}
@@ -100,6 +102,7 @@ private:
Vector<Range> m_available_ranges;
Range m_total_range;
+ mutable SpinLock<u8> m_lock;
};
inline const LogStream& operator<<(const LogStream& stream, const Range& value)