aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_edf_hsb.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-04-06 16:48:24 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-04-06 16:48:24 -0400
commitc124ecc9f502b11f331153ffaba243b7b1031a92 (patch)
tree597157a1bbc8d3f1a27b5fe5462a7a79f46b6047 /litmus/sched_edf_hsb.c
parent2a604f8edec24b291ba2c5491108808176c9020f (diff)
Consolidated data into server_domain_t.
Diffstat (limited to 'litmus/sched_edf_hsb.c')
-rw-r--r--litmus/sched_edf_hsb.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c
index e3cd78d29ce8..26f32d874916 100644
--- a/litmus/sched_edf_hsb.c
+++ b/litmus/sched_edf_hsb.c
@@ -293,7 +293,7 @@ static void donate_slack(server_t *donator, struct task_struct *was_scheduled)
293 TRACE_SERVER_SUB(donator, "donated %llu slack", TIME(donator->budget)); 293 TRACE_SERVER_SUB(donator, "donated %llu slack", TIME(donator->budget));
294 sched_trace_action(was_scheduled, 9); 294 sched_trace_action(was_scheduled, 9);
295 slack = server_alloc(GFP_ATOMIC); 295 slack = server_alloc(GFP_ATOMIC);
296 server_init(slack, donator->id, donator->budget, 296 server_init(slack, &server_domain, donator->id, donator->budget,
297 donator->period, 0); 297 donator->period, 0);
298 slack->type = S_SLACK; 298 slack->type = S_SLACK;
299 server_release_at(slack, donator->release); 299 server_release_at(slack, donator->release);
@@ -606,7 +606,7 @@ static noinline void link_server(cpu_entry_t *entry,
606 } 606 }
607 607
608 entry->linked_server = next_server; 608 entry->linked_server = next_server;
609 server_run(entry->linked_server, entry->linked, &server_domain); 609 server_run(entry->linked_server, entry->linked);
610} 610}
611 611
612/* 612/*
@@ -624,7 +624,7 @@ static noinline void unlink_server(cpu_entry_t *entry,
624 if (!entry->linked_server) 624 if (!entry->linked_server)
625 return; 625 return;
626 626
627 server_stop(entry->linked_server, &server_domain); 627 server_stop(entry->linked_server);
628 now = litmus_clock(); 628 now = litmus_clock();
629 629
630 if (is_hrt(entry->linked) && !hrt_server->ready) { 630 if (is_hrt(entry->linked) && !hrt_server->ready) {
@@ -837,8 +837,6 @@ static inline void catchup_server(server_t *server, lt_t time)
837 lt_t diff = time - server->deadline; 837 lt_t diff = time - server->deadline;
838 lt_t sub = diff % server->period; 838 lt_t sub = diff % server->period;
839 839
840 BUG_ON(server->running);
841
842 server_release_at(server, time - sub); 840 server_release_at(server, time - sub);
843 TRACE_SUB("catching up server %d to %llu", 841 TRACE_SUB("catching up server %d to %llu",
844 server->id, server->deadline); 842 server->id, server->deadline);
@@ -856,8 +854,9 @@ static struct task_struct* next_eligible_hrt(hrt_server_t *hrt_server)
856 lt_t now = litmus_clock(); 854 lt_t now = litmus_clock();
857 struct task_struct *task = NULL; 855 struct task_struct *task = NULL;
858 856
859 /* Catch up server if it is late */ 857 /* Catch up server if it is initialized, not running, and late */
860 if (hrt_server->server.deadline && !hrt_server->server.running && 858 if (hrt_server->server.deadline &&
859 !is_server_linked(&hrt_server->server) &&
861 lt_before_eq(hrt_server->server.deadline, now)) { 860 lt_before_eq(hrt_server->server.deadline, now)) {
862 catchup_server(&hrt_server->server, now); 861 catchup_server(&hrt_server->server, now);
863 slack_timer_arm(hrt_server); 862 slack_timer_arm(hrt_server);
@@ -1659,7 +1658,8 @@ static int admit_be_server(unsigned long long wcet,
1659 } 1658 }
1660 1659
1661 be_server = server_alloc(GFP_ATOMIC); 1660 be_server = server_alloc(GFP_ATOMIC);
1662 server_init(be_server, BE_SERVER_BASE + ++curr_be, 1661 server_init(be_server, &server_domain,
1662 BE_SERVER_BASE + ++curr_be,
1663 wcet, period, 1); 1663 wcet, period, 1);
1664 be_server->type = S_BE; 1664 be_server->type = S_BE;
1665 1665
@@ -1674,14 +1674,14 @@ static int admit_be_server(unsigned long long wcet,
1674/* 1674/*
1675 * Output all BE servers to a proc entry. 1675 * Output all BE servers to a proc entry.
1676 */ 1676 */
1677static void list_be_servers(struct proc_read_args *args) 1677static void list_be_servers(server_proc_t *proc)
1678{ 1678{
1679 struct list_head *pos; 1679 struct list_head *pos;
1680 server_t *be_server; 1680 server_t *be_server;
1681 1681
1682 list_for_each(pos, &be_servers) { 1682 list_for_each(pos, &be_servers) {
1683 be_server = list_entry(pos, server_t, list); 1683 be_server = list_entry(pos, server_t, list);
1684 server_proc_read_single(be_server, NO_CPU, args); 1684 list_server(be_server, NO_CPU, proc);
1685 } 1685 }
1686} 1686}
1687 1687
@@ -1724,7 +1724,8 @@ static int admit_hrt_server(unsigned long long wcet,
1724 1724
1725 hrt_server->no_slack = 0; 1725 hrt_server->no_slack = 0;
1726 1726
1727 server_init(&hrt_server->server, cpu, wcet, period, 1); 1727 server_init(&hrt_server->server, &server_domain,
1728 cpu, wcet, period, 1);
1728 hrt_server->server.type = S_HRT; 1729 hrt_server->server.type = S_HRT;
1729 1730
1730 edf_domain_init(&hrt_server->hrt_domain, NULL, 1731 edf_domain_init(&hrt_server->hrt_domain, NULL,
@@ -1741,16 +1742,16 @@ static int admit_hrt_server(unsigned long long wcet,
1741/* 1742/*
1742 * Print all HRT servers to a proc entry. 1743 * Print all HRT servers to a proc entry.
1743 */ 1744 */
1744static void list_hrt_servers(struct proc_read_args *args) 1745static void list_hrt_servers(server_proc_t *proc)
1745{ 1746{
1746 cpu_entry_t *entry; 1747 cpu_entry_t *entry;
1747 hrt_server_t *hrt_server; 1748 hrt_server_t *hrt_server;
1748 int cpu; 1749 int cpu;
1749 1750
1750 for_each_online_cpu(cpu) { 1751 for_each_online_cpu(cpu) {
1751 entry = &per_cpu(cpu_entries, cpu); 1752 entry = &per_cpu(cpu_entries, cpu);
1752 hrt_server = &entry->hrt_server; 1753 hrt_server = &entry->hrt_server;
1753 server_proc_read_single(&hrt_server->server, cpu, args); 1754 list_server(&hrt_server->server, cpu, proc);
1754 } 1755 }
1755} 1756}
1756 1757
@@ -2048,7 +2049,8 @@ static void edf_hsb_task_new(struct task_struct *task, int on_rq, int running)
2048 if (is_srt(task)) { 2049 if (is_srt(task)) {
2049 /* Create SRT server */ 2050 /* Create SRT server */
2050 srt_server = server_alloc(GFP_ATOMIC); 2051 srt_server = server_alloc(GFP_ATOMIC);
2051 server_init(srt_server, task->pid, get_exec_cost(task), 2052 server_init(srt_server, &server_domain,
2053 task->pid, get_exec_cost(task),
2052 get_rt_period(task), 0); 2054 get_rt_period(task), 0);
2053 srt_server->type = S_SRT; 2055 srt_server->type = S_SRT;
2054 srt_server->data = task; 2056 srt_server->data = task;
@@ -2157,13 +2159,6 @@ static int __init init_edf_hsb(void)
2157 goto out; 2159 goto out;
2158 } 2160 }
2159 2161
2160 /* Server proc interfaces */
2161 rv = server_proc_init(edf_hsb_proc_dir, BE_PROC_NAME,
2162 admit_be_server, list_be_servers,
2163 stop_be_servers);
2164 rv = server_proc_init(edf_hsb_proc_dir, HRT_PROC_NAME,
2165 admit_hrt_server, list_hrt_servers,
2166 stop_hrt_servers);
2167 2162
2168 task_data_cache = KMEM_CACHE(task_data, SLAB_PANIC); 2163 task_data_cache = KMEM_CACHE(task_data, SLAB_PANIC);
2169 2164
@@ -2174,6 +2169,17 @@ static int __init init_edf_hsb(void)
2174 server_domain_init(&server_domain, servers_released, 2169 server_domain_init(&server_domain, servers_released,
2175 server_completed, NO_CPU, global_lock); 2170 server_completed, NO_CPU, global_lock);
2176 2171
2172 /* Server proc interfaces */
2173 server_proc_init(&server_domain,
2174 edf_hsb_proc_dir, BE_PROC_NAME,
2175 admit_be_server, list_be_servers,
2176 stop_be_servers);
2177 server_proc_init(&server_domain,
2178 edf_hsb_proc_dir, HRT_PROC_NAME,
2179 admit_hrt_server, list_hrt_servers,
2180 stop_hrt_servers);
2181
2182
2177 /* Global collections */ 2183 /* Global collections */
2178 bheap_init(&cpu_heap); 2184 bheap_init(&cpu_heap);
2179 bheap_init(&be_ready_servers); 2185 bheap_init(&be_ready_servers);
@@ -2216,9 +2222,6 @@ static void exit_edf_hsb(void)
2216 stop_be_servers(); 2222 stop_be_servers();
2217 stop_hrt_servers(); 2223 stop_hrt_servers();
2218 2224
2219 server_proc_exit(edf_hsb_proc_dir, BE_PROC_NAME);
2220 server_proc_exit(edf_hsb_proc_dir, HRT_PROC_NAME);
2221
2222 server_domain_destroy(&server_domain); 2225 server_domain_destroy(&server_domain);
2223 2226
2224 for_each_online_cpu(cpu) { 2227 for_each_online_cpu(cpu) {