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.
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.