diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-09 21:17:30 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-09 22:10:41 +0100 |
commit | 07564577c08aa80293fd975d2565572f78e9c63c (patch) | |
tree | 076e67ced422a3c567176fb4f8fdb7dfffef90b3 /Kernel | |
parent | db0bca4153d889863983124da4002b87d7e4b23f (diff) | |
download | serenity-07564577c08aa80293fd975d2565572f78e9c63c.zip |
Kernel: Convert klog() => dmesgln() in AnonymousVMObject
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/VM/AnonymousVMObject.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index c89993a841..6c70ec1d73 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,9 +51,8 @@ RefPtr<VMObject> AnonymousVMObject::clone() }); } -#if COMMIT_DEBUG - klog() << "Cloning " << this << ", need " << need_cow_pages << " committed cow pages"; -#endif + dbgln_if(COMMIT_DEBUG, "Cloning {:p}, need {} committed cow pages", this, need_cow_pages); + if (!MM.commit_user_physical_pages(need_cow_pages)) return {}; // Create or replace the committed cow pages. When cloning a previously @@ -224,9 +223,18 @@ int AnonymousVMObject::purge_impl() if (®ion.vmobject() == this) { if (auto owner = region.get_owner()) { // we need to hold a reference the process here (if there is one) as we may not own this region - klog() << "Purged " << purged_in_range << " pages from region " << region.name() << " owned by " << *owner << " at " << region.vaddr_from_page_index(range.base) << " - " << region.vaddr_from_page_index(range.base + range.count); + dmesgln("Purged {} pages from region {} owned by {} at {} - {}", + purged_in_range, + region.name(), + *owner, + region.vaddr_from_page_index(range.base), + region.vaddr_from_page_index(range.base + range.count)); } else { - klog() << "Purged " << purged_in_range << " pages from region " << region.name() << " (no ownership) at " << region.vaddr_from_page_index(range.base) << " - " << region.vaddr_from_page_index(range.base + range.count); + dmesgln("Purged {} pages from region {} (no ownership) at {} - {}", + purged_in_range, + region.name(), + region.vaddr_from_page_index(range.base), + region.vaddr_from_page_index(range.base + range.count)); } region.remap_vmobject_page_range(range.base, range.count); } @@ -326,9 +334,7 @@ void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range) // Return those committed pages back to the system if (uncommit_page_count > 0) { -#if COMMIT_DEBUG - klog() << "Uncommit " << uncommit_page_count << " lazy-commit pages from " << this; -#endif + dbgln_if(COMMIT_DEBUG, "Uncommit {} lazy-commit pages from {:p}", uncommit_page_count, this); MM.uncommit_user_physical_pages(uncommit_page_count); } @@ -379,9 +385,8 @@ size_t AnonymousVMObject::mark_committed_pages_for_nonvolatile_range(const Volat } } -#if COMMIT_DEBUG - klog() << "Added " << pages_updated << " lazy-commit pages to " << this; -#endif + dbgln_if(COMMIT_DEBUG, "Added {} lazy-commit pages to {:p}", pages_updated, this); + m_unused_committed_pages += pages_updated; return pages_updated; } @@ -481,7 +486,7 @@ PageFaultResponse AnonymousVMObject::handle_cow_fault(size_t page_index, Virtual #endif page = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::No); if (page.is_null()) { - klog() << "MM: handle_cow_fault was unable to allocate a physical page"; + dmesgln("MM: handle_cow_fault was unable to allocate a physical page"); return PageFaultResponse::OutOfMemory; } } |