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
Notes: sideshowbarker 2024-07-19 14:01:49 +09:00

View file

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