mirror of
https://github.com/drasko/codezero.git
synced 2026-03-24 04:51:50 +01:00
Removed one goto from scheduler.
This commit is contained in:
@@ -85,7 +85,7 @@ int in_nested_irq_context(void)
|
|||||||
return (current_irq_nest_count - voluntary_preempt) > 1;
|
return (current_irq_nest_count - voluntary_preempt) > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int in_task_context(void)
|
int in_process_context(void)
|
||||||
{
|
{
|
||||||
return !in_irq_context();
|
return !in_irq_context();
|
||||||
}
|
}
|
||||||
@@ -422,20 +422,11 @@ get_runnable_task:
|
|||||||
scheduler.rq_runnable->task_list.next,
|
scheduler.rq_runnable->task_list.next,
|
||||||
struct ktcb, rq_list);
|
struct ktcb, rq_list);
|
||||||
} else {
|
} else {
|
||||||
//printk("Idle task.\n");
|
/* If process, poll forever for new tasks */
|
||||||
/* Poll forever for new tasks */
|
if (in_process_context())
|
||||||
if (in_task_context()) {
|
|
||||||
goto get_runnable_task;
|
goto get_runnable_task;
|
||||||
} else {
|
else /* If irq, resume current context */
|
||||||
/*
|
|
||||||
* If irq, return to current context without
|
|
||||||
* putting into runqueue. We want the task to
|
|
||||||
* get into the get_runnable_task loop in
|
|
||||||
* process context.
|
|
||||||
*/
|
|
||||||
next = current;
|
next = current;
|
||||||
goto switch_out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +449,6 @@ get_runnable_task:
|
|||||||
next->sched_granule = SCHED_GRANULARITY;
|
next->sched_granule = SCHED_GRANULARITY;
|
||||||
|
|
||||||
/* Finish */
|
/* Finish */
|
||||||
switch_out:
|
|
||||||
disable_irqs();
|
disable_irqs();
|
||||||
preempt_enable();
|
preempt_enable();
|
||||||
context_switch(next);
|
context_switch(next);
|
||||||
|
|||||||
Reference in New Issue
Block a user