remove some redundant mmu flush commands

The double-flush in activate() has a big impact on performance,
and I'm pretty sure it only needs to happen after the SATP update
not before, at least architecturally. Eliminating the extra
flush improves the fast message passing benchmark time by 9%.
This commit is contained in:
bunnie 2025-07-26 00:43:26 +08:00
parent c590184096
commit 25f7bd6f52
2 changed files with 2 additions and 2 deletions

View file

@ -258,7 +258,7 @@ impl MemoryMapping {
/// As such, this will only have an observable effect once code returns
/// to userspace.
pub fn activate(self) -> Result<(), xous_kernel::Error> {
unsafe { flush_mmu() };
// unsafe { flush_mmu() }; // redundant - adds 9% time to context switch benchmark when present!
satp::write(self.satp);
unsafe { flush_mmu() };
Ok(())

View file

@ -431,7 +431,7 @@ impl Swap {
true,
)
.ok();
unsafe { crate::arch::mem::flush_mmu() };
// unsafe { crate::arch::mem::flush_mmu() }; // redundant?
} else {
already_mapped = true;
}