aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2011-05-02 19:41:07 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-05-02 19:41:07 -0400
commitdae0d75128d5d4a0cd49a9525d191a9f6ffc96e0 (patch)
tree8e74eea603eb5ef5077572e682ba0149e7850388
parentb02fc68605169aa78fe0e3911170738cabe1b6a1 (diff)
Allocate background slack for idle CPU time.
Fix this. This is a fairly large hack.
-rw-r--r--litmus/sched_edf_hsb.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/litmus/sched_edf_hsb.c b/litmus/sched_edf_hsb.c
index fcad1072632a..d89364fdb582 100644
--- a/litmus/sched_edf_hsb.c
+++ b/litmus/sched_edf_hsb.c
@@ -49,6 +49,7 @@
49#define BE_PROC_NAME "be_servers" 49#define BE_PROC_NAME "be_servers"
50#define HRT_PROC_NAME "hrt_servers" 50#define HRT_PROC_NAME "hrt_servers"
51#define BE_SERVER_BASE 100 51#define BE_SERVER_BASE 100
52#define IDLE_SLACK_BASE 1000
52#define SLACK_MIN NSEC_PER_MSEC 53#define SLACK_MIN NSEC_PER_MSEC
53 54
54/* SCHED_TRACE action events */ 55/* SCHED_TRACE action events */
@@ -371,6 +372,10 @@ static noinline void check_donate_slack(server_t *donator, struct task_struct *w
371 donate_slack(donator); 372 donate_slack(donator);
372} 373}
373 374
375#else
376#define check_donate_slack(a, b)
377#endif
378
374/* 379/*
375 * Adds the task to the candidate queue if it is eligible for slack stealing. 380 * Adds the task to the candidate queue if it is eligible for slack stealing.
376 */ 381 */
@@ -432,13 +437,6 @@ static noinline struct task_struct* next_eligible_slack(void)
432 return next; 437 return next;
433} 438}
434 439
435#else
436#define check_donate_slack(a, b)
437#define check_slack_candidate(a)
438#define next_eligible_slack_server() (NULL)
439#define next_eligible_slack() (NULL)
440#endif
441
442/* 440/*
443 * Order BE tasks FIFO. 441 * Order BE tasks FIFO.
444 */ 442 */
@@ -660,6 +658,9 @@ static void reclaim_slack(server_t *slack)
660 lt_t exec; 658 lt_t exec;
661 server_t *donator = server_slack(slack); 659 server_t *donator = server_slack(slack);
662 660
661 if (!donator)
662 return;
663
663 /* SRT servers do not ever reclaim slack */ 664 /* SRT servers do not ever reclaim slack */
664 sched_trace_action(NULL, SLACK_RECLAIM_ACTION); 665 sched_trace_action(NULL, SLACK_RECLAIM_ACTION);
665 666
@@ -2413,6 +2414,7 @@ static int __init init_edf_hsb(void)
2413{ 2414{
2414 cpu_entry_t *entry; 2415 cpu_entry_t *entry;
2415 hrt_server_t *hrt_server; 2416 hrt_server_t *hrt_server;
2417 server_t *idle_slack;
2416 int rv, cpu; 2418 int rv, cpu;
2417 2419
2418 rv = register_sched_plugin(&edf_hsb_plugin); 2420 rv = register_sched_plugin(&edf_hsb_plugin);
@@ -2461,6 +2463,16 @@ static int __init init_edf_hsb(void)
2461 entry = &per_cpu(cpu_entries, cpu); 2463 entry = &per_cpu(cpu_entries, cpu);
2462 hrt_server = &entry->hrt_server; 2464 hrt_server = &entry->hrt_server;
2463 2465
2466 idle_slack = server_alloc(GFP_ATOMIC);
2467 server_init(idle_slack, &server_domain,
2468 IDLE_SLACK_BASE + cpu,
2469 ULLONG_MAX, ULLONG_MAX, 1);
2470 idle_slack->deadline = ULLONG_MAX;
2471 idle_slack->budget = ULLONG_MAX;
2472 idle_slack->job_no = 1;
2473 idle_slack->release = 1;
2474 add_slack(idle_slack);
2475
2464 entry->cpu = cpu; 2476 entry->cpu = cpu;
2465 entry->linked = NULL; 2477 entry->linked = NULL;
2466 entry->scheduled = NULL; 2478 entry->scheduled = NULL;