From 75866438b580698f3c11505c43304b725a581c14 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 18 May 2019 22:30:55 +0200 Subject: [PATCH] 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. :^) --- Kernel/FileSystem/FileDescriptor.cpp | 5 +---- 1 file changed, 1 insertion(+), 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 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; }