kernel: attempt direct switch on set prio

Prior to this commit the kernel would always trigger a full reschedule
on setPriority. This change allows the kernel to attempt a direct
switch, avoiding invoking the scheduler.

- Move location of setPriority call to after any cap deletion
  This makes the proof easier as setPriority now changes
  ksSchedulerAction, which is required to be ResumeCurrentThread or
  ChooseNewThread by the cap delete functions.
- Update to attempt direct switch on set prio.
This commit is contained in:
Anna Lyons
2017-07-05 12:15:45 +10:00
committed by Kent McLeod
parent 3e83f89990
commit d09914aaa2
2 changed files with 9 additions and 6 deletions

View File

@@ -525,8 +525,11 @@ void setPriority(tcb_t *tptr, prio_t prio)
tcbSchedDequeue(tptr);
tptr->tcbPriority = prio;
if (isRunnable(tptr)) {
SCHED_ENQUEUE(tptr);
rescheduleRequired();
if (tptr == NODE_STATE(ksCurThread)) {
rescheduleRequired();
} else {
possibleSwitchTo(tptr);
}
}
}
#endif

View File

@@ -1735,10 +1735,6 @@ exception_t invokeTCB_ThreadControl(tcb_t *target, cte_t *slot,
setMCPriority(target, mcp);
}
if (updateFlags & thread_control_update_priority) {
setPriority(target, priority);
}
#ifdef CONFIG_KERNEL_MCS
if (updateFlags & thread_control_update_sc) {
if (sc != NULL && sc != target->tcbSchedContext) {
@@ -1823,6 +1819,10 @@ exception_t invokeTCB_ThreadControl(tcb_t *target, cte_t *slot,
}
}
if (updateFlags & thread_control_update_priority) {
setPriority(target, priority);
}
return EXCEPTION_NONE;
}