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

Kernel: Don't page in entire file immediately on mmap().

If we just don't do anything, the page fault handler will load the file
incrementally as-needed instead. :^)
This commit is contained in:
Andreas Kling 2019-05-18 22:30:55 +02:00
parent f5234660f6
commit 75866438b5

View file

@ -338,12 +338,9 @@ KResultOr<Region*> FileDescriptor::mmap(Process& process, LinearAddress laddr, s
region_name = "Memory-mapped file"; region_name = "Memory-mapped file";
#endif #endif
InterruptDisabler disabler; InterruptDisabler disabler;
// FIXME: Implement mapping at a client-specified address. Most of the support is already in plcae. auto* region = process.allocate_file_backed_region(laddr, size, inode(), move(region_name), prot & PROT_READ, prot & PROT_WRITE);
ASSERT(laddr.as_ptr() == nullptr);
auto* region = process.allocate_file_backed_region(LinearAddress(), size, inode(), move(region_name), prot & PROT_READ, prot & PROT_WRITE);
if (!region) if (!region)
return KResult(-ENOMEM); return KResult(-ENOMEM);
region->page_in();
return region; return region;
} }