Avoid reaccessing AddrSpace when switching

This commit is contained in:
Wildan M
2026-04-27 02:18:42 +07:00
parent c2b20abc03
commit 2bca47923c
+9 -9
View File
@@ -485,17 +485,17 @@ impl UserInner {
});
}
let (cur_space_lock, dst_space_lock) = {
let cur_space_lock = AddrSpace::current()?;
let dst_space_lock = {
match context_weak.upgrade() {
Some(ctx) if context::is_current(&ctx) => {
let cur_space_lock = AddrSpace::current()?;
// Will bail below this code
(cur_space_lock, Arc::clone(&cur_space_lock))
Some(ctx) => {
if context::is_current(&ctx) {
// Will bail below this code
Arc::clone(&cur_space_lock)
} else {
Arc::clone(ctx.read(token.token()).addr_space()?)
}
}
Some(ctx) => (
AddrSpace::current()?,
Arc::clone(ctx.read(token.token()).addr_space()?),
),
None => return Err(Error::new(ESRCH)),
}
};