mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Kernel: Remove global MM lock in favor of SpinlockProtected
Globally shared MemoryManager state is now kept in a GlobalData struct and wrapped in SpinlockProtected. A small set of members are left outside the GlobalData struct as they are only set during boot initialization, and then remain constant. This allows us to access those members without taking any locks.
This commit is contained in:
parent
36225c0ae7
commit
a3b2b20782
6 changed files with 470 additions and 456 deletions
|
@ -41,7 +41,7 @@ RamdiskController::RamdiskController()
|
|||
{
|
||||
// Populate ramdisk controllers from Multiboot boot modules, if any.
|
||||
size_t count = 0;
|
||||
for (auto& used_memory_range : MM.used_memory_ranges()) {
|
||||
MM.for_each_used_memory_range([&](auto& used_memory_range) {
|
||||
if (used_memory_range.type == Memory::UsedMemoryRangeType::BootModule) {
|
||||
size_t length = Memory::page_round_up(used_memory_range.end.get()).release_value_but_fixme_should_propagate_errors() - used_memory_range.start.get();
|
||||
auto region_or_error = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk"sv, Memory::Region::Access::ReadWrite);
|
||||
|
@ -52,7 +52,7 @@ RamdiskController::RamdiskController()
|
|||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RamdiskController::~RamdiskController() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue