diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-04-20 12:59:58 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-04-20 12:59:58 -0400 |
commit | 607b4c70b641b87e749fc09a74070d026e318084 (patch) | |
tree | 4b39a3d7cfbf324277eaf3b179e884fa312a5122 | |
parent | a91d4578f17b20c20407195583553341c58f3f85 (diff) |
Removed flaw which could allow a task to be removed from all queues unnecessarily.
-rw-r--r-- | litmus/sched_edf_hsb.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c index 49cc75d9ea81..8ed59d873e61 100644 --- a/litmus/sched_edf_hsb.c +++ b/litmus/sched_edf_hsb.c | |||
@@ -999,8 +999,8 @@ static struct task_struct* next_eligible_hrt(hrt_server_t *hrt_server) | |||
999 | !is_server_linked(&hrt_server->server)) { | 999 | !is_server_linked(&hrt_server->server)) { |
1000 | 1000 | ||
1001 | dead = hrt_server->server.deadline; | 1001 | dead = hrt_server->server.deadline; |
1002 | slack = lt_subtract(dead, budget); | ||
1003 | budget = hrt_server->server.budget; | 1002 | budget = hrt_server->server.budget; |
1003 | slack = lt_subtract(dead, budget); | ||
1004 | 1004 | ||
1005 | TRACE_SERVER_SUB(&hrt_server->server, "dead: %llu, budget: %llu" | 1005 | TRACE_SERVER_SUB(&hrt_server->server, "dead: %llu, budget: %llu" |
1006 | "now: %llu, slack: %llu", | 1006 | "now: %llu, slack: %llu", |
@@ -1376,8 +1376,8 @@ static void preempt(cpu_entry_t *entry, struct task_struct *next, | |||
1376 | 1376 | ||
1377 | remove_from_ready(next_server, next, entry); | 1377 | remove_from_ready(next_server, next, entry); |
1378 | 1378 | ||
1379 | linked = entry->linked; | ||
1380 | check_for_slack_preempt(next, next_server, entry, slack_resched); | 1379 | check_for_slack_preempt(next, next_server, entry, slack_resched); |
1380 | linked = entry->linked; | ||
1381 | link_to_cpu(entry, next, next_server); | 1381 | link_to_cpu(entry, next, next_server); |
1382 | 1382 | ||
1383 | /* No need for this if only the server was preempted */ | 1383 | /* No need for this if only the server was preempted */ |
@@ -1396,9 +1396,9 @@ static void preempt(cpu_entry_t *entry, struct task_struct *next, | |||
1396 | * 2. slack donated by server is running a task on a different CPU | 1396 | * 2. slack donated by server is running a task on a different CPU |
1397 | */ | 1397 | */ |
1398 | static noinline void check_for_slack_preempt(struct task_struct *task, | 1398 | static noinline void check_for_slack_preempt(struct task_struct *task, |
1399 | server_t *server, | 1399 | server_t *server, |
1400 | cpu_entry_t *next_entry, | 1400 | cpu_entry_t *next_entry, |
1401 | int resched) | 1401 | int resched) |
1402 | { | 1402 | { |
1403 | cpu_entry_t *entry = NULL; | 1403 | cpu_entry_t *entry = NULL; |
1404 | server_t *slack = server_slack(server); | 1404 | server_t *slack = server_slack(server); |
@@ -1410,28 +1410,23 @@ static noinline void check_for_slack_preempt(struct task_struct *task, | |||
1410 | 1410 | ||
1411 | if (entry != next_entry) { | 1411 | if (entry != next_entry) { |
1412 | TRACE_TASK_SUB(task, "was on P%d", entry->cpu); | 1412 | TRACE_TASK_SUB(task, "was on P%d", entry->cpu); |
1413 | |||
1413 | BUG_ON(entry->linked_server->type != S_SLACK && | 1414 | BUG_ON(entry->linked_server->type != S_SLACK && |
1414 | server->type == S_SLACK && entry->linked_server->type == S_BE); | 1415 | server->type == S_SLACK && entry->linked_server->type == S_BE); |
1415 | |||
1416 | TRACE_SUB("hi"); | ||
1417 | |||
1418 | BUG_ON(entry->linked_server->type != S_SLACK && | 1416 | BUG_ON(entry->linked_server->type != S_SLACK && |
1419 | server->type == S_SRT && entry->linked_server->type == S_SRT); | 1417 | server->type == S_SRT && entry->linked_server->type == S_SRT); |
1420 | |||
1421 | TRACE_SUB("hi"); | ||
1422 | |||
1423 | BUG_ON(entry->linked_server->type != S_SLACK && | 1418 | BUG_ON(entry->linked_server->type != S_SLACK && |
1424 | server->type == S_SRT); | 1419 | server->type == S_SRT); |
1425 | |||
1426 | TRACE_SUB("hi"); | ||
1427 | |||
1428 | BUG_ON(entry->linked_server->type == S_BE && server->type == S_BE); | 1420 | BUG_ON(entry->linked_server->type == S_BE && server->type == S_BE); |
1429 | 1421 | BUG_ON(entry->linked_server->type == S_SRT && server->type == S_SLACK); | |
1430 | BUG_ON(entry->linked_server->type != S_SLACK); | 1422 | BUG_ON(entry->linked_server->type != S_SLACK); |
1431 | 1423 | ||
1432 | unlink(task); | 1424 | unlink(task); |
1433 | edf_hsb_pick_next(entry); | 1425 | |
1434 | preempt_if_preemptable(entry->scheduled, entry->cpu); | 1426 | if (resched) { |
1427 | edf_hsb_pick_next(entry); | ||
1428 | preempt_if_preemptable(entry->scheduled, entry->cpu); | ||
1429 | } | ||
1435 | } | 1430 | } |
1436 | } | 1431 | } |
1437 | 1432 | ||
@@ -1442,11 +1437,11 @@ static noinline void check_for_slack_preempt(struct task_struct *task, | |||
1442 | 1437 | ||
1443 | unlink(slack_task); | 1438 | unlink(slack_task); |
1444 | remove_slack(slack); | 1439 | remove_slack(slack); |
1440 | requeue(slack_task, get_rt_domain(entry, slack_task)); | ||
1445 | 1441 | ||
1446 | if (entry != next_entry && resched) { | 1442 | if (entry != next_entry && resched) { |
1447 | TRACE_SERVER_SUB(slack, "was on P%d", entry->cpu); | 1443 | TRACE_SERVER_SUB(slack, "was on P%d", entry->cpu); |
1448 | /* Force a reschedule */ | 1444 | /* Force a reschedule */ |
1449 | requeue(slack_task, get_rt_domain(entry, slack_task)); | ||
1450 | edf_hsb_pick_next(entry); | 1445 | edf_hsb_pick_next(entry); |
1451 | preempt_if_preemptable(entry->scheduled, entry->cpu); | 1446 | preempt_if_preemptable(entry->scheduled, entry->cpu); |
1452 | } else { | 1447 | } else { |
@@ -1791,7 +1786,7 @@ static void hrt_server_released(server_t *server) | |||
1791 | 1786 | ||
1792 | hrt_server->no_slack = 0; | 1787 | hrt_server->no_slack = 0; |
1793 | hrt_server->ready = 1; | 1788 | hrt_server->ready = 1; |
1794 | remove_slack(&hrt_server->server); | 1789 | remove_slack(server_slack(&hrt_server->server)); |
1795 | 1790 | ||
1796 | check_for_hrt_preempt(entry); | 1791 | check_for_hrt_preempt(entry); |
1797 | 1792 | ||