1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Kernel: Refactor MemoryManager to use a Bitmap rather than a Vector

This significantly reduces the pressure on the kernel heap when
allocating a lot of pages.

Previously at about 250MB allocated, the free page list would outgrow
the kernel's heap. Given that there is no longer a page list, this does
not happen.

The next barrier will be the kernel memory used by the page records for
in-use memory. This kicks in at about 1GB.
This commit is contained in:
Conrad Pankoff 2019-06-11 21:13:02 +10:00 committed by Andreas Kling
parent 1a77dfed23
commit aee9317d86
8 changed files with 278 additions and 51 deletions

View file

@ -21,21 +21,21 @@ PhysicalPage::PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_retu
, m_supervisor(supervisor)
, m_paddr(paddr)
{
if (supervisor)
++MemoryManager::s_super_physical_pages_in_existence;
else
++MemoryManager::s_user_physical_pages_in_existence;
}
void PhysicalPage::return_to_freelist()
{
ASSERT((paddr().get() & ~PAGE_MASK) == 0);
InterruptDisabler disabler;
m_retain_count = 1;
if (m_supervisor)
MM.m_free_supervisor_physical_pages.append(adopt(*this));
MM.deallocate_supervisor_physical_page(*this);
else
MM.m_free_physical_pages.append(adopt(*this));
MM.deallocate_user_physical_page(*this);
#ifdef MM_DEBUG
dbgprintf("MM: P%x released to freelist\n", m_paddr.get());
#endif