1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 16:07:45 +00:00

Kernel: Avoid O(n) loop over zones when allocating from PhysicalRegion

We now keep all the PhysicalZones on one of two intrusive lists within
the PhysicalRegion.

The "usable" list contains all zones that can be allocated from,
and the "full" list contains all zones with no free pages.
This commit is contained in:
Andreas Kling 2021-07-13 19:52:42 +02:00
parent 9ae067aa7f
commit 379bcd26e4
3 changed files with 38 additions and 10 deletions

View file

@ -11,11 +11,10 @@
#include <AK/Optional.h>
#include <AK/OwnPtr.h>
#include <Kernel/VM/PhysicalPage.h>
#include <Kernel/VM/PhysicalZone.h>
namespace Kernel {
class PhysicalZone;
class PhysicalRegion {
AK_MAKE_ETERNAL
public:
@ -44,6 +43,9 @@ private:
NonnullOwnPtrVector<PhysicalZone> m_zones;
PhysicalZone::List m_usable_zones;
PhysicalZone::List m_full_zones;
PhysicalAddress m_lower;
PhysicalAddress m_upper;
unsigned m_pages { 0 };