kernel: Remove invoke_scheduler_if_idle

This commit is contained in:
Pawel Dziepak
2013-10-21 02:38:57 +02:00
parent ea79da9500
commit 7ea42e7add
5 changed files with 5 additions and 43 deletions
-1
View File
@@ -71,7 +71,6 @@ typedef struct cpu_ent {
Thread* running_thread;
Thread* previous_thread;
bool invoke_scheduler;
bool invoke_scheduler_if_idle;
bool disabled;
// CPU topology information
+1 -2
View File
@@ -22,8 +22,7 @@ enum {
SMP_MSG_GLOBAL_INVALIDATE_PAGES,
SMP_MSG_CPU_HALT,
SMP_MSG_CALL_FUNCTION,
SMP_MSG_RESCHEDULE,
SMP_MSG_RESCHEDULE_IF_IDLE
SMP_MSG_RESCHEDULE
};
enum {
@@ -656,10 +656,9 @@ affine_enqueue(Thread* thread, bool newOne)
// reschedule anyway and update its heap key to the correct value.
affine_update_priority_heaps(targetCPU, threadPriority);
if (targetCPU == smp_get_current_cpu()) {
if (targetCPU == smp_get_current_cpu())
gCPU[targetCPU].invoke_scheduler = true;
gCPU[targetCPU].invoke_scheduler_if_idle = false;
} else {
else {
smp_send_ici(targetCPU, SMP_MSG_RESCHEDULE, 0, 0, 0, NULL,
SMP_MSG_FLAG_ASYNC);
}
@@ -840,7 +839,6 @@ reschedule_event(timer *unused)
thread->scheduler_data->lost_cpu = true;
thread->cpu->invoke_scheduler = true;
thread->cpu->invoke_scheduler_if_idle = false;
thread->cpu->preempted = 1;
return B_HANDLED_INTERRUPT;
}
@@ -960,17 +958,6 @@ affine_reschedule(void)
{
Thread* oldThread = thread_get_current_thread();
// check whether we're only supposed to reschedule, if the current thread
// is idle
if (oldThread->cpu->invoke_scheduler) {
oldThread->cpu->invoke_scheduler = false;
if (oldThread->cpu->invoke_scheduler_if_idle
&& oldThread->priority != B_IDLE_PRIORITY) {
oldThread->cpu->invoke_scheduler_if_idle = false;
return;
}
}
int32 thisCPU = smp_get_current_cpu();
int32 thisCore = sCPUToCore[thisCPU];
@@ -323,10 +323,9 @@ simple_enqueue(Thread* thread, bool newOne)
// reschedule anyway and update its heap key to the correct value.
sCPUHeap->ModifyKey(&sCPUEntries[targetCPU], threadPriority);
if (targetCPU == smp_get_current_cpu()) {
if (targetCPU == smp_get_current_cpu())
gCPU[targetCPU].invoke_scheduler = true;
gCPU[targetCPU].invoke_scheduler_if_idle = false;
} else {
else {
smp_send_ici(targetCPU, SMP_MSG_RESCHEDULE, 0, 0, 0, NULL,
SMP_MSG_FLAG_ASYNC);
}
@@ -428,7 +427,6 @@ reschedule_event(timer* /* unused */)
thread->scheduler_data->lost_cpu = true;
thread->cpu->invoke_scheduler = true;
thread->cpu->invoke_scheduler_if_idle = false;
thread->cpu->preempted = 1;
return B_HANDLED_INTERRUPT;
}
@@ -547,17 +545,6 @@ simple_reschedule(void)
{
Thread* oldThread = thread_get_current_thread();
// check whether we're only supposed to reschedule, if the current thread
// is idle
if (oldThread->cpu->invoke_scheduler) {
oldThread->cpu->invoke_scheduler = false;
if (oldThread->cpu->invoke_scheduler_if_idle
&& oldThread->priority != B_IDLE_PRIORITY) {
oldThread->cpu->invoke_scheduler_if_idle = false;
return;
}
}
int32 thisCPU = smp_get_current_cpu();
TRACE("reschedule(): cpu %ld, current thread = %ld\n", thisCPU,
-10
View File
@@ -740,16 +740,6 @@ process_pending_ici(int32 currentCPU)
{
cpu_ent* cpu = thread_get_current_thread()->cpu;
cpu->invoke_scheduler = true;
cpu->invoke_scheduler_if_idle = false;
break;
}
case SMP_MSG_RESCHEDULE_IF_IDLE:
{
cpu_ent* cpu = thread_get_current_thread()->cpu;
if (!cpu->invoke_scheduler) {
cpu->invoke_scheduler = true;
cpu->invoke_scheduler_if_idle = true;
}
break;
}