From 3c7b0dab0bd5df874d39c5518c521565ceb9d1d6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 14 Aug 2022 21:56:51 +0200 Subject: Kernel: Dump list of processes and their memory usage when OOMing --- Kernel/Memory/MemoryManager.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Kernel/Memory') 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 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; -- cgit v1.2.3