summaryrefslogtreecommitdiff
path: root/Kernel/VM/VMObject.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-07 20:12:50 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-07 20:12:50 +0200
commitb67200dfead19f571e6c2c1bedb3eb57ff72dc87 (patch)
treeb1ea4cfca8df7b471fcff43264bfac6e5683bf0a /Kernel/VM/VMObject.cpp
parent5096eaa8455fdacec8e0e23ee5ff76ec06490493 (diff)
downloadserenity-b67200dfead19f571e6c2c1bedb3eb57ff72dc87.zip
Kernel: Use a FixedArray for VMObject::m_physical_pages
This makes VMObject 8 bytes smaller since we can use the array size as the page count. The size() is now also computed from the page count instead of being a separate value. This makes sizes always be a multiple of PAGE_SIZE, which is sane.
Diffstat (limited to 'Kernel/VM/VMObject.cpp')
-rw-r--r--Kernel/VM/VMObject.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp
index e7885ffc4d..24c3b71352 100644
--- a/Kernel/VM/VMObject.cpp
+++ b/Kernel/VM/VMObject.cpp
@@ -4,18 +4,15 @@
#include <Kernel/VM/VMObject.h>
VMObject::VMObject(const VMObject& other)
- : m_size(other.m_size)
- , m_physical_pages(other.m_physical_pages)
+ : m_physical_pages(other.m_physical_pages)
{
MM.register_vmo(*this);
}
-VMObject::VMObject(size_t size, ShouldFillPhysicalPages should_fill_physical_pages)
- : m_size(size)
+VMObject::VMObject(size_t size)
+ : m_physical_pages(ceil_div(size, PAGE_SIZE))
{
MM.register_vmo(*this);
- if (should_fill_physical_pages == ShouldFillPhysicalPages::Yes)
- m_physical_pages.resize(page_count());
}
VMObject::~VMObject()