diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-04-12 17:44:31 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-04-12 17:44:31 -0400 |
commit | ec0ee6024329d429a64ec21cca1750e5dc78213a (patch) | |
tree | 8ad15e76c611c9f8c3142cbba47751dacd9fb17d | |
parent | f0e9fdc50602dabc51d04a76f3246927bb45c0e5 (diff) |
The first release of the servers is always implicit and the logic
for generating slack and causing preemptions is fixed in _schedule.
-rw-r--r-- | litmus/sched_edf_hsb.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c index 768b05280ad4..cd03cd748c60 100644 --- a/litmus/sched_edf_hsb.c +++ b/litmus/sched_edf_hsb.c | |||
@@ -645,6 +645,7 @@ static noinline void link_server(cpu_entry_t *entry, | |||
645 | } else if (next_server->type == S_HRT) { | 645 | } else if (next_server->type == S_HRT) { |
646 | /* HRT servers should never, ever migrate */ | 646 | /* HRT servers should never, ever migrate */ |
647 | BUG_ON(entry->cpu != task_cpu(entry->linked)); | 647 | BUG_ON(entry->cpu != task_cpu(entry->linked)); |
648 | BUG_ON(!entry->hrt_server.ready); | ||
648 | } else if (next_server->type == S_SLACK) { | 649 | } else if (next_server->type == S_SLACK) { |
649 | /* Should have already been removed from slack list */ | 650 | /* Should have already been removed from slack list */ |
650 | BUG_ON(head_in_list(&task_data(entry->linked)->candidate_list)); | 651 | BUG_ON(head_in_list(&task_data(entry->linked)->candidate_list)); |
@@ -662,15 +663,11 @@ static noinline void link_server(cpu_entry_t *entry, | |||
662 | server_run(entry->linked_server, entry->linked); | 663 | server_run(entry->linked_server, entry->linked); |
663 | } | 664 | } |
664 | 665 | ||
665 | |||
666 | |||
667 | /* Timer necessary whenever an HRT is not running */ | 666 | /* Timer necessary whenever an HRT is not running */ |
668 | if (!entry->linked || !is_hrt(entry->linked)) | 667 | if (!entry->linked || !is_hrt(entry->linked)) |
669 | slack_timer_arm(&entry->hrt_server); | 668 | slack_timer_arm(&entry->hrt_server); |
670 | else | 669 | else |
671 | slack_timer_cancel(&entry->hrt_server); | 670 | slack_timer_cancel(&entry->hrt_server); |
672 | |||
673 | |||
674 | } | 671 | } |
675 | 672 | ||
676 | /* | 673 | /* |
@@ -944,11 +941,11 @@ static struct task_struct* next_eligible_hrt(hrt_server_t *hrt_server) | |||
944 | now); | 941 | now); |
945 | } | 942 | } |
946 | 943 | ||
947 | if (hrt_server->ready && hrt_server->server.budget > 0) { | 944 | if (!hrt_server->server.budget || |
948 | if (task && !is_eligible(task, hrt_server)) { | 945 | (task && !is_eligible(task, hrt_server))) { |
946 | if (task) | ||
949 | TRACE_TASK_SUB(task, "not eligible"); | 947 | TRACE_TASK_SUB(task, "not eligible"); |
950 | task = NULL; | 948 | task = NULL; |
951 | } | ||
952 | } | 949 | } |
953 | 950 | ||
954 | return task; | 951 | return task; |
@@ -1755,6 +1752,7 @@ static int admit_hrt_server(unsigned long long wcet, | |||
1755 | cpu, wcet, period, 1); | 1752 | cpu, wcet, period, 1); |
1756 | server_slack_create(&hrt_server->server); | 1753 | server_slack_create(&hrt_server->server); |
1757 | hrt_server->no_slack = 0; | 1754 | hrt_server->no_slack = 0; |
1755 | hrt_server->ready = 1; | ||
1758 | hrt_server->server.type = S_HRT; | 1756 | hrt_server->server.type = S_HRT; |
1759 | 1757 | ||
1760 | edf_domain_init(&hrt_server->hrt_domain, NULL, | 1758 | edf_domain_init(&hrt_server->hrt_domain, NULL, |
@@ -1804,7 +1802,7 @@ static void stop_hrt_servers(void) | |||
1804 | slack_timer_cancel(hrt_server); | 1802 | slack_timer_cancel(hrt_server); |
1805 | 1803 | ||
1806 | hrt_server->no_slack = 0; | 1804 | hrt_server->no_slack = 0; |
1807 | hrt_server->ready = 1; | 1805 | hrt_server->ready = 0; |
1808 | hrt_server->server.period = 0; | 1806 | hrt_server->server.period = 0; |
1809 | hrt_server->server.wcet = 0; | 1807 | hrt_server->server.wcet = 0; |
1810 | } | 1808 | } |
@@ -1815,8 +1813,7 @@ static void stop_hrt_servers(void) | |||
1815 | */ | 1813 | */ |
1816 | static void start_servers(lt_t time) | 1814 | static void start_servers(lt_t time) |
1817 | { | 1815 | { |
1818 | int cpu, slack_cpu; | 1816 | int cpu; |
1819 | lt_t slack_fire; | ||
1820 | cpu_entry_t *entry; | 1817 | cpu_entry_t *entry; |
1821 | server_t *server; | 1818 | server_t *server; |
1822 | server_t *be_server; | 1819 | server_t *be_server; |
@@ -1836,28 +1833,12 @@ static void start_servers(lt_t time) | |||
1836 | if (!check_hrt_server_initialized(&entry->hrt_server)) | 1833 | if (!check_hrt_server_initialized(&entry->hrt_server)) |
1837 | goto loop_end; | 1834 | goto loop_end; |
1838 | 1835 | ||
1839 | server_release_at(server, time); | 1836 | /* Cause a catchup later */ |
1837 | server_release_at(server, time - server->period); | ||
1840 | entry->hrt_server.ready = 1; | 1838 | entry->hrt_server.ready = 1; |
1841 | 1839 | ||
1842 | slack_fire = server->deadline - server->budget; | ||
1843 | |||
1844 | #ifdef SLACK_ON_MASTER | ||
1845 | if (edf_hsb_release_master != NO_CPU) | ||
1846 | slack_cpu = edf_hsb_release_master; | ||
1847 | else | ||
1848 | #endif | ||
1849 | slack_cpu = cpu; | ||
1850 | |||
1851 | hrtimer_start_on(slack_cpu, &entry->hrt_server.slack_timer_info, | ||
1852 | &entry->hrt_server.slack_timer, | ||
1853 | ns_to_ktime(slack_fire), | ||
1854 | HRTIMER_MODE_ABS_PINNED); | ||
1855 | |||
1856 | TRACE("Setting up cpu %d to have timer deadline %llu\n", | 1840 | TRACE("Setting up cpu %d to have timer deadline %llu\n", |
1857 | cpu, TIME(server->deadline)); | 1841 | cpu, TIME(server->deadline)); |
1858 | TRACE_SUB("slack timer %d armed to fire at %llu, %p", | ||
1859 | cpu, TIME(slack_fire), &entry->hrt_server.slack_timer); | ||
1860 | |||
1861 | loop_end: | 1842 | loop_end: |
1862 | cpu = cpu; | 1843 | cpu = cpu; |
1863 | } | 1844 | } |
@@ -1869,7 +1850,9 @@ static void start_servers(lt_t time) | |||
1869 | BUG_ON(bheap_node_in_heap(be_server->hn)); | 1850 | BUG_ON(bheap_node_in_heap(be_server->hn)); |
1870 | 1851 | ||
1871 | bheap_insert(server_order, &be_ready_servers, be_server->hn); | 1852 | bheap_insert(server_order, &be_ready_servers, be_server->hn); |
1872 | server_release_at(be_server, time); | 1853 | |
1854 | /* Cause a catchup later */ | ||
1855 | server_release_at(be_server, time - be_server->period); | ||
1873 | 1856 | ||
1874 | TRACE("Releasing BE server %d\n", be_server->id); | 1857 | TRACE("Releasing BE server %d\n", be_server->id); |
1875 | TRACE_SERVER_SUB(be_server, "inserting be server"); | 1858 | TRACE_SERVER_SUB(be_server, "inserting be server"); |
@@ -2064,7 +2047,8 @@ static struct task_struct* edf_hsb_schedule(struct task_struct *prev) | |||
2064 | TRACE("NULL scheduled at %llu\n", TIME(litmus_clock())); | 2047 | TRACE("NULL scheduled at %llu\n", TIME(litmus_clock())); |
2065 | 2048 | ||
2066 | /* We generated slack. Check to see if anyone wants to use it */ | 2049 | /* We generated slack. Check to see if anyone wants to use it */ |
2067 | if (!was_slack && !list_empty(&slack_queue)) | 2050 | if (entry->linked && entry->linked_server->type != S_SLACK && |
2051 | head_in_list(&server_slack(entry->linked_server)->list)) | ||
2068 | check_for_global_preempt(); | 2052 | check_for_global_preempt(); |
2069 | 2053 | ||
2070 | raw_spin_unlock_irqrestore(global_lock, flags); | 2054 | raw_spin_unlock_irqrestore(global_lock, flags); |