xous-core/kernel/src
bunnie 8d7065d741 implement hard-OOM handler
A hard-OOM is what happens when the allocator really runs out
of memory. To review, there are two types of OOMs handled by
the swapper:

- "OOM Doom": impending OOM. This is detected by a userspace
process that can do more sophisticated processing and
algorithms to predict an impending OOM. The
OOM Doom handler is also interruptable, which allows other
progresses to make progress while memory is being cleared up,
hopefully allowing for a more graceful failure curve.

- "Hard OOM": Literally no more pages are available. This is
triggered when the page allocator can't map a single more page.
The hard-OOM handler turns off all interrupts, and all the OOM
process happens within the uninterruptable userspace context.
This effectively turns the OOM handler "inside out" compared to
the normal, interruptable userspace handler. In order to support
this, a set of calls that implement the kernel space pre-amble
and post-amble (i.e. StealPage and ReleaseMemory) are introduced.

This does introduce an extra edge case in the exit path of
the hard-OOM, namely, if the hard-OOM failed on a page that was
swapped. Here, after clearing memory, we have an empty page,
but no data; we have to again re-enter the userspace handler to
fill that page. The twist here is we have to remember to re-instate
interrupts on this edge case otherwise we lose pre-emption.
2024-05-21 01:13:13 +08:00
..
arch improve debug output on entry/exit from irqs 2024-05-21 01:11:58 +08:00
debug ok, format the kernel now that all in-line assembly has been checked 2024-01-14 19:27:14 +08:00
platform update comments and add license headers 2024-05-13 14:21:53 +08:00
args.rs ok, format the kernel now that all in-line assembly has been checked 2024-01-14 19:27:14 +08:00
io.rs allow this trait to be unused 2024-05-10 00:38:41 +08:00
irq.rs upgrade irq path to handle the new API 2024-03-23 11:59:31 +08:00
macros.rs
main.rs move MinSet to utils so that we can test it 2024-05-18 00:22:50 +08:00
mem.rs add hooks to hard-oom handler in the alloc_page_oomable routine 2024-05-21 01:07:13 +08:00
server.rs ok, format the kernel now that all in-line assembly has been checked 2024-01-14 19:27:14 +08:00
services.rs cleanup some warnings in other targets 2024-05-18 00:28:11 +08:00
swap.rs implement hard-OOM handler 2024-05-21 01:13:13 +08:00
syscall.rs add syscalls for "inverse" OOM'er 2024-05-21 01:03:42 +08:00
test.rs add unit test for MinSet / renormalization 2024-05-18 00:24:01 +08:00
utils.rs move MinSet to utils so that we can test it 2024-05-18 00:22:50 +08:00