summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/ProcFS.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-04-07 02:20:29 +0300
committerAndreas Kling <kling@serenityos.org>2021-04-12 18:03:44 +0200
commit2c93123daf6d011cc687eae9e695e8b48709add9 (patch)
tree252a47f3e7ff17d4f4dee8fe36a22ee987836651 /Kernel/FileSystem/ProcFS.cpp
parent497c759ab773b73a2f66a82ad13901b9178ee49e (diff)
downloadserenity-2c93123daf6d011cc687eae9e695e8b48709add9.zip
Kernel: Replace process' regions vector with a Red Black tree
This should provide some speed up, as currently searches for regions containing a given address were performed in O(n) complexity, while this container allows us to do those in O(logn).
Diffstat (limited to 'Kernel/FileSystem/ProcFS.cpp')
-rw-r--r--Kernel/FileSystem/ProcFS.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index ad7e714795..38246ff238 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -321,31 +321,31 @@ static bool procfs$pid_vm(InodeIdentifier identifier, KBufferBuilder& builder)
{
ScopedSpinLock lock(process->space().get_lock());
for (auto& region : process->space().regions()) {
- if (!region.is_user() && !Process::current()->is_superuser())
+ if (!region->is_user() && !Process::current()->is_superuser())
continue;
auto region_object = array.add_object();
- region_object.add("readable", region.is_readable());
- region_object.add("writable", region.is_writable());
- region_object.add("executable", region.is_executable());
- region_object.add("stack", region.is_stack());
- region_object.add("shared", region.is_shared());
- region_object.add("syscall", region.is_syscall_region());
- region_object.add("purgeable", region.vmobject().is_anonymous());
- if (region.vmobject().is_anonymous()) {
- region_object.add("volatile", static_cast<const AnonymousVMObject&>(region.vmobject()).is_any_volatile());
+ region_object.add("readable", region->is_readable());
+ region_object.add("writable", region->is_writable());
+ region_object.add("executable", region->is_executable());
+ region_object.add("stack", region->is_stack());
+ region_object.add("shared", region->is_shared());
+ region_object.add("syscall", region->is_syscall_region());
+ region_object.add("purgeable", region->vmobject().is_anonymous());
+ if (region->vmobject().is_anonymous()) {
+ region_object.add("volatile", static_cast<const AnonymousVMObject&>(region->vmobject()).is_any_volatile());
}
- region_object.add("cacheable", region.is_cacheable());
- region_object.add("address", region.vaddr().get());
- region_object.add("size", region.size());
- region_object.add("amount_resident", region.amount_resident());
- region_object.add("amount_dirty", 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());
+ region_object.add("cacheable", region->is_cacheable());
+ region_object.add("address", region->vaddr().get());
+ region_object.add("size", region->size());
+ region_object.add("amount_resident", region->amount_resident());
+ region_object.add("amount_dirty", 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) {
- auto* page = region.physical_page(i);
+ for (size_t i = 0; i < region->page_count(); ++i) {
+ auto* page = region->physical_page(i);
if (!page)
pagemap_builder.append('N');
else if (page->is_shared_zero_page() || page->is_lazy_committed_page())