1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

Kernel: Remove "supervisor" bit from PhysicalPage

Instead of each PhysicalPage knowing whether it comes from the
supervisor pages or from the user pages, we can just check in both
sets when freeing a page.

It's just a handful of pointer range checks, nothing expensive.
This commit is contained in:
Andreas Kling 2021-07-11 23:12:32 +02:00
parent ac78f1e812
commit c2792212f4
9 changed files with 39 additions and 53 deletions

View file

@ -32,7 +32,7 @@ public:
free_this();
}
static NonnullRefPtr<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true);
static NonnullRefPtr<PhysicalPage> create(PhysicalAddress, bool may_return_to_freelist = true);
u32 ref_count() const { return m_ref_count.load(AK::memory_order_consume); }
@ -40,14 +40,13 @@ public:
bool is_lazy_committed_page() const;
private:
PhysicalPage(bool supervisor, bool may_return_to_freelist = true);
explicit PhysicalPage(bool may_return_to_freelist = true);
~PhysicalPage() = default;
void free_this();
Atomic<u32> m_ref_count { 1 };
bool m_may_return_to_freelist { true };
bool m_supervisor { false };
};
struct PhysicalPageEntry {