summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-18 22:30:55 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-18 22:30:55 +0200
commit75866438b580698f3c11505c43304b725a581c14 (patch)
tree02bd30a9fe06c7c2b6998e6ae4f47cd80eccd15f
parentf5234660f6e7f0e505dd897bb67e1fedd954dd83 (diff)
downloadserenity-75866438b580698f3c11505c43304b725a581c14.zip
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. :^)
-rw-r--r--Kernel/FileSystem/FileDescriptor.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/Kernel/FileSystem/FileDescriptor.cpp b/Kernel/FileSystem/FileDescriptor.cpp
index 2e0b64e233..b158fb6eb0 100644
--- a/Kernel/FileSystem/FileDescriptor.cpp
+++ b/Kernel/FileSystem/FileDescriptor.cpp
@@ -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;
}