diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-25 01:46:44 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-25 17:28:05 +0200 |
commit | 2d1a651e0aa8be1836a07af2bbae5dfbe522de09 (patch) | |
tree | deb03d26c5278c4fde16820a0f30dba23c9d868f /Userland/Libraries/LibC/malloc.cpp | |
parent | 6bb53d6a80c9bc7e88876fa6774a253aa0ec2af5 (diff) | |
download | serenity-2d1a651e0aa8be1836a07af2bbae5dfbe522de09.zip |
Kernel: Make purgeable memory a VMObject level concept (again)
This patch changes the semantics of purgeable memory.
- AnonymousVMObject now has a "purgeable" flag. It can only be set when
constructing the object. (Previously, all anonymous memory was
effectively purgeable.)
- AnonymousVMObject now has a "volatile" flag. It covers the entire
range of physical pages. (Previously, we tracked ranges of volatile
pages, effectively making it a page-level concept.)
- Non-volatile objects maintain a physical page reservation via the
committed pages mechanism, to ensure full coverage for page faults.
- When an object is made volatile, it relinquishes any unused committed
pages immediately. If later made non-volatile again, we then attempt
to make a new committed pages reservation. If this fails, we return
ENOMEM to userspace.
mmap() now creates purgeable objects if passed the MAP_PURGEABLE option
together with MAP_ANONYMOUS. anon_create() memory is always purgeable.
Diffstat (limited to 'Userland/Libraries/LibC/malloc.cpp')
-rw-r--r-- | Userland/Libraries/LibC/malloc.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/malloc.cpp b/Userland/Libraries/LibC/malloc.cpp index 9c412c55cf..086c86c411 100644 --- a/Userland/Libraries/LibC/malloc.cpp +++ b/Userland/Libraries/LibC/malloc.cpp @@ -158,7 +158,7 @@ extern "C" { static void* os_alloc(size_t size, const char* name) { - auto* ptr = serenity_mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0, ChunkedBlock::block_size, name); + auto* ptr = serenity_mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_PURGEABLE, 0, 0, ChunkedBlock::block_size, name); VERIFY(ptr != MAP_FAILED); return ptr; } |