00001 #include "rres_config.h"
00002 #define QOS_DEBUG_LEVEL RRES_MOD_DEBUG_LEVEL
00003 #include "qos_debug.h"
00004
00005 #include "rres.h"
00006 #include "rres_kpi_protected.h"
00007 #include "rres_ready_queue.h"
00008 #include "rres_dispatch.h"
00009 #include "rres_algorithms.h"
00010 #include "kal_timer.h"
00011 #include "qos_func.h"
00012
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #if 0
00031
00036 qos_rv rres_move(server_t * new_srv, kal_task_t *task);
00037
00039 qos_rv rres_move_all(server_t *new_srv, server_t *old_srv) {
00040 struct list_head *h, *tmp_h;
00041 kal_task_t *task_tmp;
00042
00043 old_srv->forbid_reorder = 1;
00044 rres_sample_time();
00045 for_each_task_in_server_safe(old_srv, task_tmp, h, tmp_h)
00046 qos_chk_ok_ret(rres_move_nosched(new_srv, task_tmp));
00047 qos_chk_ok_ret(rres_check_destroy(old_srv));
00048 old_srv = NULL;
00049 rres_schedule();
00050 return QOS_OK;
00051 }
00052
00056 int rres_move_opt(kal_task_t *task, server_t * new_srv)
00057 {
00058 struct list_head *h, *tmp_h;
00059 kal_task_t *task_tmp;
00060 server_t * old_srv = rres_find_by_task(task);
00061
00062 rres_sample_time();
00063 for_each_task_in_server_safe(old_srv, task_tmp, h, tmp_h) {
00064 if(task_tmp == task) {
00065 list_del(h);
00066 #ifdef CONFIG_RRES_DEFAULT_SRV
00067 if (is_default_server(new_srv)) {
00068 qos_free(get_task_entry(h));
00069 task_tmp->private_data = default_srv;
00070 } else
00071 #else
00072 rres_add_simple(new_srv, get_task_entry(h));
00073 #endif
00074 if (task_running(task)) {
00075 rres_deactivate_nosched(old_srv);
00076 rres_activate_nosched(new_srv);
00077 sync_task_with_server(new_srv, task);
00078
00079 }
00080 rres_schedule();
00081 return 0;
00082 }
00083 }
00084 return -1;
00085 }
00086
00088 qos_rv rres_move_all_to_default_srv(server_t * srv)
00089 {
00090 struct list_head *h, *tmp_h;
00091 kal_task_t *task_tmp;
00092
00093 rres_sample_time();
00094 for_each_task_in_server_safe(srv, task_tmp, h, tmp_h) {
00095 list_del(h);
00096 qos_free(get_task_entry(h));
00097 task_tmp->private_data = default_srv;
00098 if (task_running(task_tmp)) {
00099 qos_chk_ok_ret(rres_deactivate_nosched(srv));
00100 qos_chk_ok_ret(rres_activate_nosched(default_srv));
00101
00102
00103 sync_task_with_server(default_srv, task_tmp);
00104 }
00105 }
00106 return QOS_OK;
00107 }
00108
00113 int rres_move_all_opt(server_t *old_srv, server_t *new_srv)
00114 {
00115 struct list_head *h, *tmp_h;
00116 kal_task_t *task_tmp;
00117 int call_sched = 0;
00118
00119 rres_sample_time();
00120 #ifdef CONFIG_RRES_DEFAULT_SRV
00121 if (is_default_server(new_srv)) {
00122 return rres_move_all_to_default_srv(old_srv);
00123 }
00124 #endif
00125 for_each_task_in_server_safe(old_srv, task_tmp, h, tmp_h) {
00126 list_del(h);
00127 rres_add_simple(new_srv, get_task_entry(h));
00128 if (task_running(task_tmp)) {
00129 call_sched += rres_deactivate_nosched(old_srv);
00130 call_sched += rres_activate_nosched(new_srv);
00131 sync_task_with_server(default_srv, task_tmp);
00132
00133 }
00134 }
00135
00136
00137
00138
00139
00140
00141
00142 if (call_sched)
00143 return RRES_NEED_RESCHED;
00144 return 0;
00145 }
00146
00147 int rres_detach_all_tasks_opt(server_t * srv) {}
00148 int rres_attach_all_tasks_opt(list) {}
00149
00150 #endif // #if 0