1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

Kernel: Change kmalloc lock to be recursive

If the heap code dumps a stack trace (e.g. out of memory) then
it may recursively call into it. Rather than deadlocking, allow
recursion.
This commit is contained in:
Tom 2020-07-02 08:34:11 -06:00 committed by Andreas Kling
parent 038dd9f30e
commit 3cc0e86cd8
2 changed files with 6 additions and 1 deletions

View file

@ -103,6 +103,11 @@ public:
{
return m_lock.load(AK::memory_order_consume) != 0;
}
ALWAYS_INLINE void initialize()
{
m_lock.store(0, AK::memory_order_release);
}
};
template <typename BaseType = u32, typename LockType = SpinLock<BaseType>>