mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-27 20:52:01 +00:00
Kernel: Make KBuffer lazily populated
KBuffers are now zero-filled on demand instead of up front. This means that you can create a huge KBuffer and it will only take up VM, not physical pages (until you access them.)
This commit is contained in:
parent
a0bb592b4f
commit
c973a51a23
Notes:
sideshowbarker
2024-07-19 12:51:09 +09:00
Author: https://github.com/awesomekling
Commit: c973a51a23
3 changed files with 5 additions and 4 deletions
|
@ -461,7 +461,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault)
|
|||
return PageFaultResponse::ShouldCrash;
|
||||
}
|
||||
|
||||
RefPtr<Region> MemoryManager::allocate_kernel_region(size_t size, const StringView& name, bool user_accessible)
|
||||
RefPtr<Region> MemoryManager::allocate_kernel_region(size_t size, const StringView& name, bool user_accessible, bool should_commit)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
ASSERT(!(size % PAGE_SIZE));
|
||||
|
@ -474,7 +474,8 @@ RefPtr<Region> MemoryManager::allocate_kernel_region(size_t size, const StringVi
|
|||
region = Region::create_kernel_only(range, name, PROT_READ | PROT_WRITE | PROT_EXEC, false);
|
||||
MM.map_region_at_address(*m_kernel_page_directory, *region, range.base());
|
||||
// FIXME: It would be cool if these could zero-fill on demand instead.
|
||||
region->commit();
|
||||
if (should_commit)
|
||||
region->commit();
|
||||
return region;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue