From 5f7056d62c6ecf51bd5e5a1cdc597850a03915c2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 28 Feb 2020 20:58:57 +0100 Subject: [PATCH] Kernel: Expose the VMObject type of each Region in /proc/PID/vm --- Kernel/FileSystem/ProcFS.cpp | 1 + Kernel/VM/AnonymousVMObject.h | 2 ++ Kernel/VM/PrivateInodeVMObject.h | 2 ++ Kernel/VM/PurgeableVMObject.h | 2 ++ Kernel/VM/SharedInodeVMObject.h | 2 ++ Kernel/VM/VMObject.h | 2 ++ 6 files changed, 11 insertions(+) diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 79c4840ed81..66b6721bc87 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -315,6 +315,7 @@ Optional procfs$pid_vm(InodeIdentifier identifier) region_object.add("amount_dirty", (u32)region.amount_dirty()); region_object.add("cow_pages", region.cow_pages()); region_object.add("name", region.name()); + region_object.add("vmobject", region.vmobject().class_name()); StringBuilder pagemap_builder; for (size_t i = 0; i < region.page_count(); ++i) { diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h index 3b9631c6f0c..9972bab1a4f 100644 --- a/Kernel/VM/AnonymousVMObject.h +++ b/Kernel/VM/AnonymousVMObject.h @@ -44,6 +44,8 @@ protected: explicit AnonymousVMObject(size_t); explicit AnonymousVMObject(const AnonymousVMObject&); + virtual const char* class_name() const override { return "AnonymousVMObject"; } + private: AnonymousVMObject(PhysicalAddress, size_t); diff --git a/Kernel/VM/PrivateInodeVMObject.h b/Kernel/VM/PrivateInodeVMObject.h index 4a1d8a87a49..7f0d3998bc8 100644 --- a/Kernel/VM/PrivateInodeVMObject.h +++ b/Kernel/VM/PrivateInodeVMObject.h @@ -45,6 +45,8 @@ private: explicit PrivateInodeVMObject(Inode&, size_t); explicit PrivateInodeVMObject(const PrivateInodeVMObject&); + virtual const char* class_name() const override { return "PrivateInodeVMObject"; } + PrivateInodeVMObject& operator=(const PrivateInodeVMObject&) = delete; }; diff --git a/Kernel/VM/PurgeableVMObject.h b/Kernel/VM/PurgeableVMObject.h index 715df1d7749..5e100aa5f02 100644 --- a/Kernel/VM/PurgeableVMObject.h +++ b/Kernel/VM/PurgeableVMObject.h @@ -50,6 +50,8 @@ private: explicit PurgeableVMObject(size_t); explicit PurgeableVMObject(const PurgeableVMObject&); + virtual const char* class_name() const override { return "PurgeableVMObject"; } + int purge_impl(); PurgeableVMObject& operator=(const PurgeableVMObject&) = delete; diff --git a/Kernel/VM/SharedInodeVMObject.h b/Kernel/VM/SharedInodeVMObject.h index c8c33206c93..f817ac673c7 100644 --- a/Kernel/VM/SharedInodeVMObject.h +++ b/Kernel/VM/SharedInodeVMObject.h @@ -45,6 +45,8 @@ private: explicit SharedInodeVMObject(Inode&, size_t); explicit SharedInodeVMObject(const SharedInodeVMObject&); + virtual const char* class_name() const override { return "SharedInodeVMObject"; } + SharedInodeVMObject& operator=(const SharedInodeVMObject&) = delete; }; diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h index 67bb137850d..ff62f8d0a93 100644 --- a/Kernel/VM/VMObject.h +++ b/Kernel/VM/VMObject.h @@ -59,6 +59,8 @@ public: size_t size() const { return m_physical_pages.size() * PAGE_SIZE; } + virtual const char* class_name() const = 0; + // For InlineLinkedListNode VMObject* m_next { nullptr }; VMObject* m_prev { nullptr };