mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
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.
This commit is contained in:
parent
bc5d6992a4
commit
c3451899bc
7 changed files with 30 additions and 15 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue