1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

Revert "Kernel: Make PhysicalPage not movable and use atomic ref counting"

This reverts commit a89ccd842b.
This commit is contained in:
Andreas Kling 2020-08-22 16:34:11 +02:00
parent 23f335bcd7
commit 0db7e04c2e
5 changed files with 24 additions and 20 deletions

View file

@ -39,29 +39,29 @@ class PhysicalPage {
friend class PageDirectory;
friend class VMObject;
MAKE_SLAB_ALLOCATED(PhysicalPage);
AK_MAKE_NONMOVABLE(PhysicalPage);
MAKE_SLAB_ALLOCATED(PhysicalPage)
public:
PhysicalAddress paddr() const { return m_paddr; }
void ref()
{
m_ref_count.fetch_add(1, AK::memory_order_acq_rel);
ASSERT(m_ref_count);
++m_ref_count;
}
void unref()
{
if (m_ref_count.fetch_sub(1, AK::memory_order_acq_rel) == 1) {
ASSERT(m_ref_count);
if (!--m_ref_count) {
if (m_may_return_to_freelist)
return_to_freelist();
move(*this).return_to_freelist();
delete this;
}
}
static NonnullRefPtr<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true);
u32 ref_count() const { return m_ref_count.load(AK::memory_order_consume); }
u32 ref_count() const { return m_ref_count; }
bool is_shared_zero_page() const;
@ -69,9 +69,9 @@ private:
PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist = true);
~PhysicalPage() {}
void return_to_freelist() const;
void return_to_freelist() &&;
Atomic<u32> m_ref_count { 1 };
u32 m_ref_count { 1 };
bool m_may_return_to_freelist { true };
bool m_supervisor { false };
PhysicalAddress m_paddr;