Kernel: Use PrivateInodeVMObject for loading program executables
This will be a memory usage pessimization until we actually implement CoW sharing of the memory pages with SharedInodeVMObject. However, it's a huge architectural improvement, so let's take it and improve on this incrementally. fork() should still be neutral, since all private mappings are CoW'ed.
This commit is contained in:
parent
48bbfe51fb
commit
e2697c2ddd
Notes:
sideshowbarker
2024-07-19 08:57:39 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e2697c2dddd
1 changed files with 3 additions and 11 deletions
|
@ -67,6 +67,7 @@
|
|||
#include <Kernel/TTY/TTY.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/PageDirectory.h>
|
||||
#include <Kernel/VM/PrivateInodeVMObject.h>
|
||||
#include <Kernel/VM/PurgeableVMObject.h>
|
||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||
#include <LibBareMetal/IO.h>
|
||||
|
@ -808,17 +809,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
if (parts.is_empty())
|
||||
return -ENOENT;
|
||||
|
||||
RefPtr<SharedInodeVMObject> vmobject;
|
||||
if (interpreter_description) {
|
||||
vmobject = SharedInodeVMObject::create_with_inode(*interpreter_description->inode());
|
||||
} else {
|
||||
vmobject = SharedInodeVMObject::create_with_inode(*main_program_description->inode());
|
||||
}
|
||||
|
||||
if (static_cast<const SharedInodeVMObject&>(*vmobject).writable_mappings()) {
|
||||
dbg() << "Refusing to execute a write-mapped program";
|
||||
return -ETXTBSY;
|
||||
}
|
||||
auto& inode = interpreter_description ? *interpreter_description->inode() : *main_program_description->inode();
|
||||
auto vmobject = PrivateInodeVMObject::create_with_inode(inode);
|
||||
|
||||
// Disable profiling temporarily in case it's running on this process.
|
||||
bool was_profiling = is_profiling();
|
||||
|
|
Loading…
Add table
Reference in a new issue