diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-06 21:11:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-06 22:28:23 +0200 |
commit | 6fe83b0ac4f734f0dfe159b99136a4c56c83a7d0 (patch) | |
tree | 00f7b5bbca6b6506413c95821e8ecb3e6c2f9002 /Kernel/VM/Region.h | |
parent | c633c1c2eab688284d9339a8c6dfab525e776aca (diff) | |
download | serenity-6fe83b0ac4f734f0dfe159b99136a4c56c83a7d0.zip |
Kernel: Crash the current process on OOM (instead of panicking kernel)
This patch adds PageFaultResponse::OutOfMemory which informs the fault
handler that we were unable to allocate a necessary physical page and
cannot continue.
In response to this, the kernel will crash the current process. Because
we are OOM, we can't symbolicate the crash like we normally would
(since the ELF symbolication code needs to allocate), so we also
communicate to Process::crash() that we're out of memory.
Now we can survive "allocate 300 MB" (only the allocate process dies.)
This is definitely not perfect and can easily end up killing a random
innocent other process who happened to allocate one page at the wrong
time, but it's a *lot* better than panicking on OOM. :^)
Diffstat (limited to 'Kernel/VM/Region.h')
-rw-r--r-- | Kernel/VM/Region.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 1d95ea8844..546702da61 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -40,6 +40,7 @@ class VMObject; enum class PageFaultResponse { ShouldCrash, + OutOfMemory, Continue, }; |