1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

Kernel: Make PhysicalRegion::return_page() do arithmetic instead of loop

Most of the time, we will be freeing physical pages within the
full-sized zones. We can do some simple math to find the right zone
immediately instead of looping through the zones, checking each one.

We still do loop through the slack/remainder zones at the end.
There's probably an even nicer way to solve this, but this is already a
nice improvement. :^)
This commit is contained in:
Andreas Kling 2021-12-11 19:00:47 +01:00
parent 63117f826b
commit 259cca456f
2 changed files with 21 additions and 8 deletions

View file

@ -41,6 +41,9 @@ public:
private:
PhysicalRegion(PhysicalAddress lower, PhysicalAddress upper);
static constexpr size_t large_zone_size = 16 * MiB;
static constexpr size_t small_zone_size = 1 * MiB;
NonnullOwnPtrVector<PhysicalZone> m_zones;
PhysicalZone::List m_usable_zones;