summaryrefslogtreecommitdiff
path: root/Kernel/VM/PhysicalPage.h
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/VM/PhysicalPage.h')
-rw-r--r--Kernel/VM/PhysicalPage.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h
index 92dcd20e24..498ce7dd03 100644
--- a/Kernel/VM/PhysicalPage.h
+++ b/Kernel/VM/PhysicalPage.h
@@ -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;