mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 06:27:35 +00:00
Kernel: When physical page allocation fails, try to purge something
Instead of panicking right away when we run out of physical pages, we now try to find a PurgeableVMObject with some volatile pages in it. If we find one, we purge that entire object and steal one of its pages. This makes it possible for the kernel to keep going instead of dying. Very cool. :^)
This commit is contained in:
parent
dafd715743
commit
c1f8291ce4
3 changed files with 36 additions and 3 deletions
|
@ -29,6 +29,19 @@ NonnullRefPtr<VMObject> PurgeableVMObject::clone()
|
|||
int PurgeableVMObject::purge()
|
||||
{
|
||||
LOCKER(m_paging_lock);
|
||||
return purge_impl();
|
||||
}
|
||||
|
||||
int PurgeableVMObject::purge_with_interrupts_disabled(Badge<MemoryManager>)
|
||||
{
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
if (m_paging_lock.is_locked())
|
||||
return 0;
|
||||
return purge_impl();
|
||||
}
|
||||
|
||||
int PurgeableVMObject::purge_impl()
|
||||
{
|
||||
if (!m_volatile)
|
||||
return 0;
|
||||
int purged_page_count = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue