summaryrefslogtreecommitdiff
path: root/Kernel/Memory
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-14 21:56:51 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-14 23:33:28 +0200
commit3c7b0dab0bd5df874d39c5518c521565ceb9d1d6 (patch)
tree8afd856142fda1daceecdab4e397f747b474ca88 /Kernel/Memory
parent9e9924115f68c0cf7c24697510ed07b726529983 (diff)
downloadserenity-3c7b0dab0bd5df874d39c5518c521565ceb9d1d6.zip
Kernel: Dump list of processes and their memory usage when OOMing
Diffstat (limited to 'Kernel/Memory')
-rw-r--r--Kernel/Memory/MemoryManager.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index 0b312fa4a6..77ad11449c 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -828,8 +828,21 @@ ErrorOr<CommittedPhysicalPageSet> MemoryManager::commit_physical_pages(size_t pa
{
VERIFY(page_count > 0);
SpinlockLocker lock(s_mm_lock);
- if (m_system_memory_info.physical_pages_uncommitted < page_count)
+ if (m_system_memory_info.physical_pages_uncommitted < page_count) {
+ dbgln("MM: Unable to commit {} pages, have only {}", page_count, m_system_memory_info.physical_pages_uncommitted);
+
+ Process::for_each([&](Process const& process) {
+ dbgln("{}({}) resident:{}, shared:{}, virtual:{}",
+ process.name(),
+ process.pid(),
+ process.address_space().amount_resident() / PAGE_SIZE,
+ process.address_space().amount_shared() / PAGE_SIZE,
+ process.address_space().amount_virtual() / PAGE_SIZE);
+ return IterationDecision::Continue;
+ });
+
return ENOMEM;
+ }
m_system_memory_info.physical_pages_uncommitted -= page_count;
m_system_memory_info.physical_pages_committed += page_count;