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

Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage

I believe this to be safe, as the main thing that LockRefPtr provides
over RefPtr is safe copying from a shared LockRefPtr instance. I've
inspected the uses of RefPtr<PhysicalPage> and it seems they're all
guarded by external locking. Some of it is less obvious, but this is
an area where we're making continuous headway.
This commit is contained in:
Andreas Kling 2022-08-24 15:56:26 +02:00
parent 5a804b9a1d
commit 2c72d495a3
33 changed files with 141 additions and 138 deletions

View file

@ -10,8 +10,8 @@
#include <AK/Badge.h>
#include <AK/HashMap.h>
#include <AK/IntrusiveRedBlackTree.h>
#include <AK/RefPtr.h>
#include <Kernel/Forward.h>
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/PhysicalPage.h>
@ -64,13 +64,13 @@ private:
AddressSpace* m_space { nullptr };
#if ARCH(X86_64)
LockRefPtr<PhysicalPage> m_pml4t;
RefPtr<PhysicalPage> m_pml4t;
#endif
LockRefPtr<PhysicalPage> m_directory_table;
RefPtr<PhysicalPage> m_directory_table;
#if ARCH(X86_64)
LockRefPtr<PhysicalPage> m_directory_pages[512];
RefPtr<PhysicalPage> m_directory_pages[512];
#else
LockRefPtr<PhysicalPage> m_directory_pages[4];
RefPtr<PhysicalPage> m_directory_pages[4];
#endif
RecursiveSpinlock m_lock { LockRank::None };
};