sunriseos / SunriseOS

Horizon/NX kernel reimplementation
Apache License 2.0
230 stars 13 forks source link

Kernel heap memory management #97

Open todo[bot] opened 5 years ago

todo[bot] commented 5 years ago

Currently, if the kernel ever OOMs, this will lead to a panic. This is really not ideal. Unfortunately, we depend on a lot of Rust structures that make use of allocation (Arc, Vec, String...). Some of those have methods to customize OOM behavior (Vec and String have try_reserve), but some structures (like Arc) seem to be devoid of any function to avoid OOM. Maybe we should approach the rust developers, see if they would accept a try_new function on Arc/Rc that would return an AllocErr if it fails. Alternatively, we could start using our own Arc/Rc forks.


https://github.com/roblabla42/KFS/blob/adee47274ba5c0dc0ef112ce8933becd63d3da77/kernel/src/heap_allocator.rs#L108-L118


This issue was generated by todo based on a TODO comment in adee47274ba5c0dc0ef112ce8933becd63d3da77 when #90 was merged. cc @roblabla.
roblabla commented 5 years ago

https://switchbrew.org/w/index.php?title=Kernel_objects#Slab_Information has information about all object slab sizes, if we decide to go down that road.