update comment to reflect current policy on OOM

I think it's more Xous-y to punt to userland in the case that
no consecutive memory is found, rather than trying to implement
an evictor in the kernel itself.

For now, the blunt hammer we use is to simply request some
blocks be freed and we retry; this works well enough to find
blocks of a few pages in sequence. If we needed larger blocks,
we may want to consider modifying the swapper userland algorithm
to have some API for finding consecutive runs of non-wired
memory to swap out.
This commit is contained in:
bunnie 2024-06-19 21:37:00 +08:00
parent 6ba57774cf
commit c5aee47861

View file

@ -640,15 +640,11 @@ impl MemoryManager {
#[cfg(feature = "debug-swap")]
println!("Block found starting at {:x}", phys);
} else {
// See below comment about future enhancement to use swap to clear a memory range
return Err(xous_kernel::Error::OutOfMemory);
}
} else {
// couldn't find a contiguous location large enough; OOM for now.
//
// If swap memory is active, we could recode this case to search for the
// longest existing run, and try to extend it by evicting physical pages
// to swap. But let's keep it simple for now.
// Punt to userland to clear up memory.
return Err(xous_kernel::Error::OutOfMemory);
}
}