A test has shown that more than 16% of the calls to task_wakeup()
could be avoided because the task is already woken up. So make it
inline and move the test to the inline part.
int init_task();
/* puts the task <t> in run queue <q>, and returns <t> */
-struct task *task_wakeup(struct task *t);
+struct task *__task_wakeup(struct task *t);
+static inline struct task *task_wakeup(struct task *t)
+{
+ if (t->state == TASK_RUNNING)
+ return t;
+ return __task_wakeup(t);
+}
/* removes the task <t> from the run queue if it was in it.
* returns <t>.
* size. A nice value of -1024 sets the task to -run_queue*32, while a nice
* value of 1024 sets the task to run_queue*32.
*/
-struct task *task_wakeup(struct task *t)
+struct task *__task_wakeup(struct task *t)
{
- if (t->state == TASK_RUNNING)
- return t;
-
task_dequeue(t);
run_queue++;
/* detach the task from the queue and add the task to the run queue */
eb = eb32_next(eb);
- task_wakeup(task);
+ __task_wakeup(task);
}
tree = (tree + 1) & TIMER_TREE_MASK;
} while (((tree - now_tree) & TIMER_TREE_MASK) < TIMER_TREES/2);