From 3364da388f17fe1da1f9d3c0518e3917359159ae Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 7 Aug 2019 16:14:08 +0200 Subject: [PATCH] Kernel: Remove VMObject names The VMObject name was always either the owning region's name, or the absolute path of the underlying inode. We can reconstitute this information if wanted, no need to keep copies of these strings around. --- Kernel/FileSystem/ProcFS.cpp | 8 +++----- Kernel/Process.cpp | 3 +-- Kernel/VM/Region.cpp | 1 - Kernel/VM/VMObject.cpp | 3 +-- Kernel/VM/VMObject.h | 4 ---- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index fe10c7659b..c451f8f530 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -311,9 +311,8 @@ Optional procfs$pid_vmo(InodeIdentifier identifier) region.vaddr().offset(region.size() - 1).get(), region.size(), region.name().characters()); - builder.appendf("VMO: %s \"%s\" @ %x(%u)\n", + builder.appendf("VMO: %s @ %x(%u)\n", region.vmo().is_anonymous() ? "anonymous" : "file-backed", - region.vmo().name().characters(), ®ion.vmo(), region.vmo().ref_count()); for (int i = 0; i < region.vmo().page_count(); ++i) { @@ -395,12 +394,11 @@ Optional procfs$mm(InodeIdentifier) InterruptDisabler disabler; StringBuilder builder; for (auto* vmo : MM.m_vmos) { - builder.appendf("VMO: %p %s(%u): p:%4u %s\n", + builder.appendf("VMO: %p %s(%u): p:%4u\n", vmo, vmo->is_anonymous() ? "anon" : "file", vmo->ref_count(), - vmo->page_count(), - vmo->name().characters()); + vmo->page_count()); } builder.appendf("VMO count: %u\n", MM.m_vmos.size()); builder.appendf("Free physical pages: %u\n", MM.user_physical_pages() - MM.user_physical_pages_used()); diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index df9f5649f1..11cd0977d1 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -340,8 +340,7 @@ int Process::do_exec(String path, Vector arguments, Vector envir ProcessPagingScope paging_scope(*this); auto vmo = VMObject::create_file_backed(description->inode()); - vmo->set_name(description->absolute_path()); - RefPtr region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo, 0, vmo->name(), PROT_READ); + RefPtr region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo, 0, description->absolute_path(), PROT_READ); ASSERT(region); if (this != ¤t->process()) { diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 20db77fd4e..24bd907342 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -12,7 +12,6 @@ Region::Region(const Range& range, const String& name, u8 access, bool cow) , m_access(access) , m_cow_map(Bitmap::create(m_vmo->page_count(), cow)) { - m_vmo->set_name(m_name); MM.register_region(*this); } diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp index 417ee2f7e3..45ef59b567 100644 --- a/Kernel/VM/VMObject.cpp +++ b/Kernel/VM/VMObject.cpp @@ -33,8 +33,7 @@ NonnullRefPtr VMObject::clone() } VMObject::VMObject(VMObject& other) - : m_name(other.m_name) - , m_inode_offset(other.m_inode_offset) + : m_inode_offset(other.m_inode_offset) , m_size(other.m_size) , m_inode(other.m_inode) , m_physical_pages(other.m_physical_pages) diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h index f435a7b931..4bd24749cd 100644 --- a/Kernel/VM/VMObject.h +++ b/Kernel/VM/VMObject.h @@ -30,9 +30,6 @@ public: const Inode* inode() const { return m_inode.ptr(); } size_t inode_offset() const { return m_inode_offset; } - const String& name() const { return m_name; } - void set_name(const String& name) { m_name = name; } - int page_count() const { return m_size / PAGE_SIZE; } const Vector>& physical_pages() const { return m_physical_pages; } Vector>& physical_pages() { return m_physical_pages; } @@ -51,7 +48,6 @@ private: template void for_each_region(Callback); - String m_name; bool m_allow_cpu_caching { true }; off_t m_inode_offset { 0 }; size_t m_size { 0 };