1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:25:08 +00:00

Kernel: Remove the limited use of AK::TypeTraits we had in the kernel

This was only used for VMObject and we can do without it there. This is
preparation for migrating to dynamic_cast-based helpers in userspace.
This commit is contained in:
Andreas Kling 2021-01-01 15:32:06 +01:00
parent aa92adeedf
commit 7c3b6b10e4
7 changed files with 10 additions and 23 deletions

View file

@ -509,8 +509,10 @@ RefPtr<PhysicalPage> MemoryManager::allocate_user_physical_page(ShouldZeroFill s
if (!page) {
// We didn't have a single free physical page. Let's try to free something up!
// First, we look for a purgeable VMObject in the volatile state.
for_each_vmobject_of_type<PurgeableVMObject>([&](auto& vmobject) {
int purged_page_count = vmobject.purge_with_interrupts_disabled({});
for_each_vmobject([&](auto& vmobject) {
if (!vmobject.is_purgeable())
return IterationDecision::Continue;
int purged_page_count = static_cast<PurgeableVMObject&>(vmobject).purge_with_interrupts_disabled({});
if (purged_page_count) {
klog() << "MM: Purge saved the day! Purged " << purged_page_count << " pages from PurgeableVMObject{" << &vmobject << "}";
page = find_free_user_physical_page();