diff options
author | Tom <tomut@yahoo.com> | 2020-09-03 15:06:25 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-01 23:43:44 +0100 |
commit | c3451899bcbdb1b268ff862ae37263d6ee99a423 (patch) | |
tree | bd277d683e7cc89f9e5b6be35f394b7e97229d7b /Kernel/VM/Region.h | |
parent | bc5d6992a44be838c225bfd88be0aa4f978ddd66 (diff) | |
download | serenity-c3451899bcbdb1b268ff862ae37263d6ee99a423.zip |
Kernel: Add MAP_NORESERVE support to mmap
Rather than lazily committing regions by default, we now commit
the entire region unless MAP_NORESERVE is specified.
This solves random crashes in low-memory situations where e.g. the
malloc heap allocated memory, but using pages that haven't been
used before triggers a crash when no more physical memory is available.
Use this flag to create large regions without actually committing
the backing memory. madvise() can be used to commit arbitrary areas
of such regions after creating them.
Diffstat (limited to 'Kernel/VM/Region.h')
-rw-r--r-- | Kernel/VM/Region.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 46159d8c8c..e1ec47a6bc 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -159,6 +159,7 @@ public: return m_offset_in_vmobject; } + bool can_commit() const; bool commit(); size_t amount_resident() const; @@ -193,7 +194,7 @@ public: void set_inherit_mode(InheritMode inherit_mode) { m_inherit_mode = inherit_mode; } - bool remap_page_range(size_t page_index, size_t page_count); + bool remap_page_range(size_t page_index, size_t page_count, bool do_commit); bool is_volatile(VirtualAddress vaddr, size_t size) const; enum class SetVolatileError { |