Avoid reaccessing AddrSpace when switching
This commit is contained in:
+9
-9
@@ -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)),
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user