summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-13 22:38:23 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-13 23:08:45 +0200
commit0a21d421d922af6e03c2180e80edf496d0686ff1 (patch)
tree2201252f71ac3578f7c05d80190168bdb65440cf /Kernel
parentbf5e4326ac03264d503495b4b7b1996753d2bfe7 (diff)
downloadserenity-0a21d421d922af6e03c2180e80edf496d0686ff1.zip
Kernel: Print a summary of physical zones during boot
Let's not print out every single zone, since that gets very noisy on machines with a lot of RAM. :^)
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/VM/PhysicalRegion.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/Kernel/VM/PhysicalRegion.cpp b/Kernel/VM/PhysicalRegion.cpp
index 6b74058e4c..3560186fd8 100644
--- a/Kernel/VM/PhysicalRegion.cpp
+++ b/Kernel/VM/PhysicalRegion.cpp
@@ -42,17 +42,24 @@ void PhysicalRegion::initialize_zones()
size_t remaining_pages = m_pages;
auto base_address = m_lower;
- auto make_zones = [&](size_t zone_size) {
- while (remaining_pages >= zone_size) {
- m_zones.append(make<PhysicalZone>(base_address, zone_size));
- dmesgln(" * Zone {:016x}-{:016x} ({} bytes)", base_address.get(), base_address.get() + zone_size * PAGE_SIZE - 1, zone_size * PAGE_SIZE);
- base_address = base_address.offset(zone_size * PAGE_SIZE);
+ auto make_zones = [&](size_t pages_per_zone) {
+ size_t zone_count = 0;
+ auto first_address = base_address;
+ while (remaining_pages >= pages_per_zone) {
+ m_zones.append(make<PhysicalZone>(base_address, pages_per_zone));
+ base_address = base_address.offset(pages_per_zone * PAGE_SIZE);
m_usable_zones.append(m_zones.last());
- remaining_pages -= zone_size;
+ remaining_pages -= pages_per_zone;
+ ++zone_count;
}
+ if (zone_count)
+ dmesgln(" * {}x PhysicalZone ({} MiB) @ {:016x}-{:016x}", zone_count, pages_per_zone / 256, first_address.get(), base_address.get() - pages_per_zone * PAGE_SIZE - 1);
};
+ // First make 16 MiB zones (with 4096 pages each)
make_zones(4096);
+
+ // Then divide any remaining space into 1 MiB zones (with 256 pages each)
make_zones(256);
}