aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--litmus/sched_edf_hsb.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c
index 8ed59d873e61..fc533502f5ac 100644
--- a/litmus/sched_edf_hsb.c
+++ b/litmus/sched_edf_hsb.c
@@ -974,10 +974,10 @@ static struct task_struct* next_eligible_slack(void)
974{ 974{
975 struct task_struct *next = get_candidate(slack_candidates.next); 975 struct task_struct *next = get_candidate(slack_candidates.next);
976 976
977 /* We couldn't find an SRT to schedule. Find a BE which is
978 * either tardy or cannot run due to a lack of servers.
979 */
977 if (!next) { 980 if (!next) {
978 /* We couldn't find an SRT to schedule. Find a BE which is
979 * either tardy or cannot run due to a lack of servers.
980 */
981 next = __peek_ready(&be_domain); 981 next = __peek_ready(&be_domain);
982 } 982 }
983 return next; 983 return next;
@@ -1289,6 +1289,10 @@ static void remove_from_ready(server_t *server, struct task_struct *task,
1289 cpu_entry_t *entry) 1289 cpu_entry_t *entry)
1290{ 1290{
1291 server_t *slack; 1291 server_t *slack;
1292 rt_domain_t *domain;
1293 BUG_ON(!server);
1294 BUG_ON(!entry);
1295 BUG_ON(!task);
1292 1296
1293 if (server->type == S_SLACK) { 1297 if (server->type == S_SLACK) {
1294 TRACE_SERVER_SUB(server, "removed from slack list"); 1298 TRACE_SERVER_SUB(server, "removed from slack list");
@@ -1301,20 +1305,26 @@ static void remove_from_ready(server_t *server, struct task_struct *task,
1301 } 1305 }
1302 } else { 1306 } else {
1303 slack = server_slack(server); 1307 slack = server_slack(server);
1308 BUG_ON(!slack);
1304 if (head_in_list(&slack->list)) { 1309 if (head_in_list(&slack->list)) {
1305 remove_slack(slack); 1310 remove_slack(slack);
1306 } 1311 }
1307 if (server->type == S_BE) { 1312 if (server->type == S_BE) {
1308 TRACE_SERVER_SUB(server, "server removed from ready"); 1313 TRACE_SERVER_SUB(server, "server removed from ready");
1314 BUG_ON(!server->hn);
1309 bheap_delete(server_order, &be_ready_servers, 1315 bheap_delete(server_order, &be_ready_servers,
1310 server->hn); 1316 server->hn);
1311 } 1317 }
1312 if (is_queued(task)) { 1318 if (is_queued(task)) {
1319 domain = get_rt_domain(entry, task);
1320 BUG_ON(!domain);
1313 TRACE_TASK_SUB(task, "removed from ready"); 1321 TRACE_TASK_SUB(task, "removed from ready");
1314 remove(get_rt_domain(entry, task), task); 1322 remove(domain, task);
1315 } 1323 }
1316 } 1324 }
1317 1325
1326 BUG_ON(!task_data(task));
1327
1318 /* Remove from consideration of slack servers */ 1328 /* Remove from consideration of slack servers */
1319 if (head_in_list(&task_data(task)->candidate_list)) { 1329 if (head_in_list(&task_data(task)->candidate_list)) {
1320 TRACE_TASK_SUB(task, "deleting candidate"); 1330 TRACE_TASK_SUB(task, "deleting candidate");
@@ -1411,16 +1421,6 @@ static noinline void check_for_slack_preempt(struct task_struct *task,
1411 if (entry != next_entry) { 1421 if (entry != next_entry) {
1412 TRACE_TASK_SUB(task, "was on P%d", entry->cpu); 1422 TRACE_TASK_SUB(task, "was on P%d", entry->cpu);
1413 1423
1414 BUG_ON(entry->linked_server->type != S_SLACK &&
1415 server->type == S_SLACK && entry->linked_server->type == S_BE);
1416 BUG_ON(entry->linked_server->type != S_SLACK &&
1417 server->type == S_SRT && entry->linked_server->type == S_SRT);
1418 BUG_ON(entry->linked_server->type != S_SLACK &&
1419 server->type == S_SRT);
1420 BUG_ON(entry->linked_server->type == S_BE && server->type == S_BE);
1421 BUG_ON(entry->linked_server->type == S_SRT && server->type == S_SLACK);
1422 BUG_ON(entry->linked_server->type != S_SLACK);
1423
1424 unlink(task); 1424 unlink(task);
1425 1425
1426 if (resched) { 1426 if (resched) {
@@ -2063,6 +2063,8 @@ static long edf_hsb_admit_task(struct task_struct *task)
2063{ 2063{
2064 cpu_entry_t *entry = task_sched_entry(task); 2064 cpu_entry_t *entry = task_sched_entry(task);
2065 2065
2066 TRACE_TASK(task, "Admitting\n");
2067
2066 if (is_hrt(task)) { 2068 if (is_hrt(task)) {
2067 return check_hrt_server_initialized(&entry->hrt_server) && 2069 return check_hrt_server_initialized(&entry->hrt_server) &&
2068 ((task_cpu(task) == task->rt_param.task_params.cpu) && 2070 ((task_cpu(task) == task->rt_param.task_params.cpu) &&
@@ -2190,13 +2192,6 @@ static struct task_struct* edf_hsb_schedule(struct task_struct *prev)
2190 TIME(litmus_clock()), entry->hrt_server.no_slack, 2192 TIME(litmus_clock()), entry->hrt_server.no_slack,
2191 entry->hrt_server.ready); 2193 entry->hrt_server.ready);
2192 2194
2193 if (curr != prev && prev->pid == 0) {
2194 TRACE_SUB("should bug");
2195 } else if (curr && !is_realtime(prev)) {
2196 TRACE_TASK_SUB(prev, "not realtime");
2197 BUG_ON(1);
2198 }
2199
2200 /* Determine state */ 2195 /* Determine state */
2201 blocks = curr && !is_running(curr); 2196 blocks = curr && !is_running(curr);
2202 preempted = entry->scheduled != entry->linked; 2197 preempted = entry->scheduled != entry->linked;