aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-04-23 13:48:20 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-04-23 13:48:20 -0400
commit0af9eb33d537b57b2dfd1bb8c31aea1cd40984ed (patch)
treec9bd6c38cf26d73c271056aeda5d9e71b7159114
parent61a2998397ab7ab42c5d6f410a8a89dec6ffd93b (diff)
Allow slack stealing to be enabled / disabled via the config file.
-rw-r--r--litmus/Kconfig8
-rw-r--r--litmus/sched_edf_hsb.c92
2 files changed, 58 insertions, 42 deletions
diff --git a/litmus/Kconfig b/litmus/Kconfig
index ad8dc8308cf0..46563edf513c 100644
--- a/litmus/Kconfig
+++ b/litmus/Kconfig
@@ -34,6 +34,14 @@ config RELEASE_MASTER
34 (http://www.cs.unc.edu/~anderson/papers.html). 34 (http://www.cs.unc.edu/~anderson/papers.html).
35 Currently only supported by GSN-EDF. 35 Currently only supported by GSN-EDF.
36 36
37config EDF_HSB_SLACK_STEALING
38 bool "EDF-HSB Slack Stealing"
39 depends on ARCH_HAS_SEND_PULL_TIMERS
40 default y
41 help
42 Allow servers in EDF-HSB to donate slack when they have no real-time
43 tasks to execute.
44
37endmenu 45endmenu
38 46
39menu "Real-Time Synchronization" 47menu "Real-Time Synchronization"
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c
index e5d5c5faa834..658a85c7177b 100644
--- a/litmus/sched_edf_hsb.c
+++ b/litmus/sched_edf_hsb.c
@@ -325,6 +325,7 @@ static void donate_slack(server_t *donator)
325 add_slack(slack); 325 add_slack(slack);
326} 326}
327 327
328#ifdef CONFIG_EDF_HSB_SLACK_STEALING
328/* 329/*
329 * Donate any available slack from a server. 330 * Donate any available slack from a server.
330 */ 331 */
@@ -387,6 +388,55 @@ static void check_slack_candidate(struct task_struct *task)
387} 388}
388 389
389/* 390/*
391 * Returns the next eligible slack server. This will remove any expired
392 * slack servers still present in the list.
393 */
394static noinline server_t* next_eligible_slack_server(void)
395{
396 server_t *next_slack = NULL;
397
398 while (!list_empty(&slack_queue)) {
399 next_slack = list_entry(slack_queue.next, server_t, list);
400 BUG_ON(!next_slack);
401
402 if (lt_after(next_slack->deadline, litmus_clock()) &&
403 lt_after(next_slack->budget, SLACK_MIN)) {
404 break;
405 } else {
406 /* Slack has expired or has too little time */
407 remove_slack(next_slack);
408 next_slack = NULL;
409 }
410 }
411
412 return next_slack;
413}
414
415/*
416 * Returns the next SRT task that is tardy or will be tardy. If none
417 * are available, will return a tardy BE task if present.
418 */
419static noinline struct task_struct* next_eligible_slack(void)
420{
421 struct task_struct *next = get_candidate(slack_candidates.next);
422
423 /* We couldn't find an SRT to schedule. Find a BE which is
424 * either tardy or cannot run due to a lack of servers.
425 */
426 if (!next) {
427 next = __peek_ready(&be_domain);
428 }
429 return next;
430}
431
432#else
433#define check_donate_slack(a, b)
434#define check_slack_candidate(a)
435#define next_eligible_slack_server() (NULL)
436#define next_eligible_slack() (NULL)
437#endif
438
439/*
390 * Order BE tasks FIFO. 440 * Order BE tasks FIFO.
391 */ 441 */
392static inline int be_higher_prio(struct task_struct *first, struct task_struct *second) 442static inline int be_higher_prio(struct task_struct *first, struct task_struct *second)
@@ -937,48 +987,6 @@ static noinline int catchup_srt_server(struct task_struct *task)
937} 987}
938 988
939/* 989/*
940 * Returns the next eligible slack server. This will remove any expired
941 * slack servers still present in the list.
942 */
943static noinline server_t* next_eligible_slack_server(void)
944{
945 server_t *next_slack = NULL;
946
947 while (!list_empty(&slack_queue)) {
948 next_slack = list_entry(slack_queue.next, server_t, list);
949 BUG_ON(!next_slack);
950
951 if (lt_after(next_slack->deadline, litmus_clock()) &&
952 lt_after(next_slack->budget, SLACK_MIN)) {
953 break;
954 } else {
955 /* Slack has expired or has too little time */
956 remove_slack(next_slack);
957 next_slack = NULL;
958 }
959 }
960
961 return next_slack;
962}
963
964/*
965 * Returns the next SRT task that is tardy or will be tardy. If none
966 * are available, will return a tardy BE task if present.
967 */
968static noinline struct task_struct* next_eligible_slack(void)
969{
970 struct task_struct *next = get_candidate(slack_candidates.next);
971
972 /* We couldn't find an SRT to schedule. Find a BE which is
973 * either tardy or cannot run due to a lack of servers.
974 */
975 if (!next) {
976 next = __peek_ready(&be_domain);
977 }
978 return next;
979}
980
981/*
982 * If the server is eligible, return the next eligible job. If the server is 990 * If the server is eligible, return the next eligible job. If the server is
983 * ineligible or there are no eligible jobs, returns NULL. This will re-release 991 * ineligible or there are no eligible jobs, returns NULL. This will re-release
984 * any servers that are behind. 992 * any servers that are behind.