aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2011-01-28 17:29:03 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2011-01-28 19:18:53 -0500
commit1a6154cb07727ae9716de118da15dbdb399983b9 (patch)
tree73b222136d53fff9564306b6a64204bba6203618 /include/litmus
parentb8be8fb192541fad88983ef6f9270cec1b51b59a (diff)
Implementation of the EDZL scheduler.wip-edzl-final
Implementation of the EDZL scheduler. Zero-laxity points are tracked by timers while jobs are in the pending state. Locking primatives are not supported.
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/edzl_common.h14
-rw-r--r--include/litmus/litmus.h21
-rw-r--r--include/litmus/rt_param.h15
-rw-r--r--include/litmus/sched_global_plugin.h6
4 files changed, 53 insertions, 3 deletions
diff --git a/include/litmus/edzl_common.h b/include/litmus/edzl_common.h
new file mode 100644
index 000000000000..d1a89ee08554
--- /dev/null
+++ b/include/litmus/edzl_common.h
@@ -0,0 +1,14 @@
1/*
2 * EDZL common data structures and utility functions shared by all EDZL
3 * based scheduler plugins
4 */
5
6#ifndef __UNC_EDZL_COMMON_H__
7#define __UNC_EDZL_COMMON_H__
8
9#include <litmus/rt_domain.h>
10
11int edzl_higher_prio(struct task_struct* first,
12 struct task_struct* second);
13
14#endif
diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h
index 246483783fc0..3203a0809f96 100644
--- a/include/litmus/litmus.h
+++ b/include/litmus/litmus.h
@@ -54,6 +54,12 @@ void litmus_exit_task(struct task_struct *tsk);
54#define get_release(t) (tsk_rt(t)->job_params.release) 54#define get_release(t) (tsk_rt(t)->job_params.release)
55#define get_class(t) (tsk_rt(t)->task_params.cls) 55#define get_class(t) (tsk_rt(t)->task_params.cls)
56 56
57#ifdef CONFIG_PLUGIN_EDZL
58#define get_zerolaxity(t) (tsk_rt(t)->job_params.zero_laxity)
59#define set_zerolaxity(t) (tsk_rt(t)->job_params.zero_laxity=1)
60#define clear_zerolaxity(t) (tsk_rt(t)->job_params.zero_laxity=0)
61#endif
62
57inline static int budget_exhausted(struct task_struct* t) 63inline static int budget_exhausted(struct task_struct* t)
58{ 64{
59 return get_exec_time(t) >= get_exec_cost(t); 65 return get_exec_time(t) >= get_exec_cost(t);
@@ -86,6 +92,21 @@ static inline lt_t litmus_clock(void)
86 return ktime_to_ns(ktime_get()); 92 return ktime_to_ns(ktime_get());
87} 93}
88 94
95#ifdef CONFIG_PLUGIN_EDZL
96inline static lt_t laxity_remaining(struct task_struct* t)
97{
98 lt_t now = litmus_clock();
99 lt_t remaining = budget_remaining(t);
100 lt_t deadline = get_deadline(t);
101
102 if(lt_before(now + remaining, deadline))
103 return (deadline - (now + remaining));
104 else
105 return 0;
106}
107#endif
108
109
89/* A macro to convert from nanoseconds to ktime_t. */ 110/* A macro to convert from nanoseconds to ktime_t. */
90#define ns_to_ktime(t) ktime_add_ns(ktime_set(0, 0), t) 111#define ns_to_ktime(t) ktime_add_ns(ktime_set(0, 0), t)
91 112
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index a7a183f34a80..41768f446436 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -90,6 +90,14 @@ struct rt_job {
90 * Increase this sequence number when a job is released. 90 * Increase this sequence number when a job is released.
91 */ 91 */
92 unsigned int job_no; 92 unsigned int job_no;
93
94#ifdef CONFIG_PLUGIN_EDZL
95 /* boolean indicating zero-laxity state. We will
96 set this flag explicitly at zero-laxity detection.
97 This makes priority comparison operations more
98 predictable since laxity varies with time */
99 unsigned int zero_laxity:1;
100#endif
93}; 101};
94 102
95struct pfair_param; 103struct pfair_param;
@@ -113,6 +121,11 @@ struct rt_param {
113 121
114 /* timing parameters */ 122 /* timing parameters */
115 struct rt_job job_params; 123 struct rt_job job_params;
124
125#ifdef CONFIG_PLUGIN_EDZL
126 /* used to trigger zero-laxity detection */
127 struct hrtimer zl_timer;
128#endif
116 129
117 /* task representing the current "inherited" task 130 /* task representing the current "inherited" task
118 * priority, assigned by inherit_priority and 131 * priority, assigned by inherit_priority and
@@ -120,7 +133,7 @@ struct rt_param {
120 * could point to self if PI does not result in 133 * could point to self if PI does not result in
121 * an increased task priority. 134 * an increased task priority.
122 */ 135 */
123 struct task_struct* inh_task; 136 struct task_struct* inh_task;
124 137
125#ifdef CONFIG_NP_SECTION 138#ifdef CONFIG_NP_SECTION
126 /* For the FMLP under PSN-EDF, it is required to make the task 139 /* For the FMLP under PSN-EDF, it is required to make the task
diff --git a/include/litmus/sched_global_plugin.h b/include/litmus/sched_global_plugin.h
index cac2de63a3ee..21a91817eac1 100644
--- a/include/litmus/sched_global_plugin.h
+++ b/include/litmus/sched_global_plugin.h
@@ -29,7 +29,7 @@ typedef struct task_struct* (*take_ready_t)(rt_domain_t* rt);
29typedef void (*add_ready_t)(rt_domain_t* rt, struct task_struct *new); 29typedef void (*add_ready_t)(rt_domain_t* rt, struct task_struct *new);
30typedef void (*job_arrival_t)(struct task_struct* task); 30typedef void (*job_arrival_t)(struct task_struct* task);
31typedef void (*job_completion_t)(struct task_struct *t, int forced); 31typedef void (*job_completion_t)(struct task_struct *t, int forced);
32 32typedef int (*preemption_needed_t)(struct task_struct *t);
33 33
34struct sched_global_plugin { 34struct sched_global_plugin {
35 35
@@ -41,6 +41,7 @@ struct sched_global_plugin {
41 add_ready_t add_ready; 41 add_ready_t add_ready;
42 job_arrival_t job_arrival; 42 job_arrival_t job_arrival;
43 job_completion_t job_completion; 43 job_completion_t job_completion;
44 preemption_needed_t preemption_needed;
44 45
45 rt_domain_t domain; 46 rt_domain_t domain;
46 47
@@ -60,7 +61,6 @@ extern struct sched_global_plugin* active_gbl_plugin;
60 * 61 *
61 * Use prefix "gbl_" (global) 62 * Use prefix "gbl_" (global)
62 */ 63 */
63int gbl_preemption_needed(struct task_struct *t);
64int gbl_ready_order(struct bheap_node* a, struct bheap_node* b); 64int gbl_ready_order(struct bheap_node* a, struct bheap_node* b);
65int gbl_cpu_lower_prio(struct bheap_node *_a, struct bheap_node *_b); 65int gbl_cpu_lower_prio(struct bheap_node *_a, struct bheap_node *_b);
66void gbl_update_cpu_position(cpu_entry_t *entry); 66void gbl_update_cpu_position(cpu_entry_t *entry);
@@ -69,6 +69,7 @@ void gbl_link_task_to_cpu(struct task_struct* linked, cpu_entry_t *entry);
69void gbl_unlink(struct task_struct* t); 69void gbl_unlink(struct task_struct* t);
70void gbl_preempt(cpu_entry_t *entry); 70void gbl_preempt(cpu_entry_t *entry);
71void gbl_requeue(struct task_struct* task); 71void gbl_requeue(struct task_struct* task);
72void gbl_update_queue_position(struct task_struct *task);
72void gbl_check_for_preemptions(void); 73void gbl_check_for_preemptions(void);
73void gbl_release_jobs(rt_domain_t* rt, struct bheap* tasks); 74void gbl_release_jobs(rt_domain_t* rt, struct bheap* tasks);
74void gbl_job_completion(struct task_struct *t, int forced); 75void gbl_job_completion(struct task_struct *t, int forced);
@@ -87,6 +88,7 @@ long gbl_activate_plugin(void* plugin);
87 * Use prefix "gblv_" (global virtual) 88 * Use prefix "gblv_" (global virtual)
88 */ 89 */
89void gblv_job_arrival(struct task_struct* task); 90void gblv_job_arrival(struct task_struct* task);
91int gblv_preemption_needed(struct task_struct *t);
90void gblv_tick(struct task_struct* t); 92void gblv_tick(struct task_struct* t);
91struct task_struct* gblv_schedule(struct task_struct * prev); 93struct task_struct* gblv_schedule(struct task_struct * prev);
92void gblv_finish_switch(struct task_struct *prev); 94void gblv_finish_switch(struct task_struct *prev);