mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02:00
Kernel: Dump list of processes and their memory usage when OOMing
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 08:14:32 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3c7b0dab0b
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user