Do not push idle context to queue
This commit is contained in:
+1
-3
@@ -126,7 +126,7 @@ pub fn init(token: &mut CleanLockToken) {
|
||||
|
||||
let context_ref = ContextRef(Arc::clone(&context_lock));
|
||||
contexts_mut(token.token().downgrade()).insert(context_ref.clone());
|
||||
|
||||
// Set this as current context and idle context, but don't treat it as regular context queue
|
||||
unsafe {
|
||||
let percpu = PercpuBlock::current();
|
||||
percpu
|
||||
@@ -134,8 +134,6 @@ pub fn init(token: &mut CleanLockToken) {
|
||||
.set_current_context(Arc::clone(&context_lock));
|
||||
percpu.switch_internals.set_idle_context(context_lock);
|
||||
}
|
||||
|
||||
run_contexts(token.downgrade()).set[priority].push_back(context_ref);
|
||||
}
|
||||
|
||||
pub fn wakeup_context(context_lock: &Arc<RwLock<L4, Context>>, mut token: LockToken<L0>) {
|
||||
|
||||
@@ -413,12 +413,6 @@ fn select_next_context(
|
||||
continue; // Lazy removal of blocked contexts
|
||||
}
|
||||
|
||||
// Do not spawn the kernel (the idle context) again after idling,
|
||||
// otherwise the next switch will idling again
|
||||
if was_idle && !next_context_guard.userspace {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Is this context runnable on this CPU?
|
||||
if let UpdateResult::CanSwitch =
|
||||
unsafe { update_runnable(&mut next_context_guard, cpu_id, switch_time) }
|
||||
@@ -452,7 +446,7 @@ fn select_next_context(
|
||||
return Ok(Some(next_context_guard));
|
||||
} else {
|
||||
let idle_context = percpu.switch_internals.idle_context();
|
||||
if !Arc::ptr_eq(&prev_context_lock, &idle_context) {
|
||||
if !was_idle && !Arc::ptr_eq(&prev_context_lock, &idle_context) {
|
||||
// We switch into the idle context
|
||||
Ok(Some(unsafe { idle_context.write_arc() }))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user