00001
00014
00015
00016
00017
00018
00019 #ifndef __DISPATCH_GSD_26_H__
00020 #define __DISPATCH_GSD_26_H__
00021
00022 #include "rres_config.h"
00023
00024 #include <linux/sched.h>
00025
00026 #define GENSCHED_DISABLED 1024
00027 #define RRES_DISPATCH_PRIORITY 65
00030 static inline int task_ready(struct task_struct * task) {
00031 return ((task->state == TASK_RUNNING) || (task->state == GENSCHED_DISABLED));
00032 }
00033
00034 #ifdef __AQUOSA_OLD_PATCH
00035 #define set_task_rr_prio genschedify
00036 #endif
00037
00038
00039 #define rres_init_sched_param(task) \
00040 set_task_rr_prio(task, RRES_DISPATCH_PRIORITY)
00041
00042 #define rres_task_sched_default(task) \
00043 do { \
00044 if (task->state == GENSCHED_DISABLED) \
00045 task->state = TASK_RUNNING; \
00046 set_task_rr_prio(task, -1); \
00047 } while (0)
00048
00050 static inline void stop_task(struct task_struct *t) {
00051 unsigned long flags;
00052 read_lock_irqsave(&tasklist_lock, flags);
00053 qos_log_state(t);
00054 if (t->state == TASK_RUNNING) {
00055 set_task_state(t, GENSCHED_DISABLED);
00056 }
00057 qos_log_state(t);
00058 read_unlock_irqrestore(&tasklist_lock, flags);
00059 }
00060
00062 static inline void dispatch_task(struct task_struct *t) {
00063 unsigned long flags;
00064
00065 read_lock_irqsave(&tasklist_lock, flags);
00066 qos_log_state(t);
00067 if (t->state == GENSCHED_DISABLED) {
00068 if (!t->array) {
00069 set_task_state(t, TASK_STOPPED);
00070 wake_up_process(t);
00071 } else {
00072 set_task_state(t, TASK_RUNNING);
00073 }
00074 }
00075 qos_log_state(t);
00076 read_unlock_irqrestore(&tasklist_lock, flags);
00077 }
00078
00080 static inline void rres_idle_cpu(void) {
00081 set_tsk_need_resched(kal_task_current());
00082 }
00083
00084 #endif
00085