mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +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:
parent
5a804b9a1d
commit
2c72d495a3
33 changed files with 141 additions and 138 deletions
|
@ -17,17 +17,17 @@ SpinlockProtected<VMObject::AllInstancesList>& VMObject::all_instances()
|
|||
return s_all_instances;
|
||||
}
|
||||
|
||||
ErrorOr<FixedArray<LockRefPtr<PhysicalPage>>> VMObject::try_clone_physical_pages() const
|
||||
ErrorOr<FixedArray<RefPtr<PhysicalPage>>> VMObject::try_clone_physical_pages() const
|
||||
{
|
||||
return m_physical_pages.try_clone();
|
||||
}
|
||||
|
||||
ErrorOr<FixedArray<LockRefPtr<PhysicalPage>>> VMObject::try_create_physical_pages(size_t size)
|
||||
ErrorOr<FixedArray<RefPtr<PhysicalPage>>> VMObject::try_create_physical_pages(size_t size)
|
||||
{
|
||||
return FixedArray<LockRefPtr<PhysicalPage>>::try_create(ceil_div(size, static_cast<size_t>(PAGE_SIZE)));
|
||||
return FixedArray<RefPtr<PhysicalPage>>::try_create(ceil_div(size, static_cast<size_t>(PAGE_SIZE)));
|
||||
}
|
||||
|
||||
VMObject::VMObject(FixedArray<LockRefPtr<PhysicalPage>>&& new_physical_pages)
|
||||
VMObject::VMObject(FixedArray<RefPtr<PhysicalPage>>&& new_physical_pages)
|
||||
: m_physical_pages(move(new_physical_pages))
|
||||
{
|
||||
all_instances().with([&](auto& list) { list.append(*this); });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue