aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-03-22 15:13:17 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2013-03-22 15:13:17 -0400
commit4e28e863475df7c27c2e9ecba4e2cdd409bf044e (patch)
treec306c974df6ce4662380d48ebb6a61b01bc40720
parent7bbf3205ae1979cb41fd2a0dfdd103656bf8e84e (diff)
work in progress.
-rw-r--r--include/litmus/bheap.h7
-rw-r--r--include/litmus/budget.h7
-rw-r--r--include/litmus/rt_param.h2
-rw-r--r--litmus/bheap.c12
-rw-r--r--litmus/budget.c24
-rw-r--r--litmus/sched_cedf.c126
-rw-r--r--litmus/sched_gsn_edf.c3
-rw-r--r--litmus/sched_pfp.c3
-rw-r--r--litmus/sched_psn_edf.c3
9 files changed, 156 insertions, 31 deletions
diff --git a/include/litmus/bheap.h b/include/litmus/bheap.h
index cf4864a498d8..49f7e44bc0a5 100644
--- a/include/litmus/bheap.h
+++ b/include/litmus/bheap.h
@@ -24,6 +24,8 @@ struct bheap {
24 * This speeds up repeated peek operations. 24 * This speeds up repeated peek operations.
25 */ 25 */
26 struct bheap_node* min; 26 struct bheap_node* min;
27
28// unsigned int size;
27}; 29};
28 30
29typedef int (*bheap_prio_t)(struct bheap_node* a, struct bheap_node* b); 31typedef int (*bheap_prio_t)(struct bheap_node* a, struct bheap_node* b);
@@ -41,6 +43,11 @@ static inline int bheap_empty(struct bheap* heap)
41 return heap->head == NULL && heap->min == NULL; 43 return heap->head == NULL && heap->min == NULL;
42} 44}
43 45
46//static inline unsigned int bheap_size(struct bheap* heap)
47//{
48// return heap->size;
49//}
50
44/* insert (and reinitialize) a node into the heap */ 51/* insert (and reinitialize) a node into the heap */
45void bheap_insert(bheap_prio_t higher_prio, 52void bheap_insert(bheap_prio_t higher_prio,
46 struct bheap* heap, 53 struct bheap* heap,
diff --git a/include/litmus/budget.h b/include/litmus/budget.h
index 72f04777e0b0..4f1bdd101a9e 100644
--- a/include/litmus/budget.h
+++ b/include/litmus/budget.h
@@ -58,6 +58,8 @@ typedef void (*preempt_t)(struct task_struct* t);
58typedef void (*sleep_t)(struct task_struct* t); 58typedef void (*sleep_t)(struct task_struct* t);
59typedef enum hrtimer_restart (*exhausted_t)(struct task_struct* t); 59typedef enum hrtimer_restart (*exhausted_t)(struct task_struct* t);
60typedef void (*exit_t)(struct task_struct* t); 60typedef void (*exit_t)(struct task_struct* t);
61typedef void (*inherit_t)(struct task_struct* t, struct task_struct* prio_inh);
62typedef void (*disinherit_t)(struct task_struct* t, struct task_struct* prio_inh);
61 63
62struct budget_tracker_ops 64struct budget_tracker_ops
63{ 65{
@@ -69,6 +71,9 @@ struct budget_tracker_ops
69 exit_t on_exit; /* task exiting rt mode */ 71 exit_t on_exit; /* task exiting rt mode */
70 72
71 exhausted_t on_exhausted; /* called by plugin::tick() or timer interrupt */ 73 exhausted_t on_exhausted; /* called by plugin::tick() or timer interrupt */
74
75 inherit_t on_inherit;
76 disinherit_t on_disinherit;
72}; 77};
73 78
74struct budget_tracker 79struct budget_tracker
@@ -108,6 +113,8 @@ void sobliv_on_sleep(struct task_struct* t);
108/* Use the DRAIN_SIMPLE implementations */ 113/* Use the DRAIN_SIMPLE implementations */
109#define sobliv_on_preempt simple_on_preempt 114#define sobliv_on_preempt simple_on_preempt
110#define sobliv_on_exit simple_on_exit 115#define sobliv_on_exit simple_on_exit
116void sobliv_on_inherit(struct task_struct* t, struct task_struct* prio_inh);
117void sobliv_on_disinherit(struct task_struct* t, struct task_struct* prio_inh);
111 118
112 119
113void init_budget_tracker(struct budget_tracker* bt, 120void init_budget_tracker(struct budget_tracker* bt,
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index 499ecd899fcd..40bdb26faebe 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -422,6 +422,8 @@ struct rt_param {
422 */ 422 */
423 struct task_struct* inh_task; 423 struct task_struct* inh_task;
424 424
425 struct task_struct* inh_task_linkback;
426
425#ifdef CONFIG_REALTIME_AUX_TASKS 427#ifdef CONFIG_REALTIME_AUX_TASKS
426 unsigned int is_aux_task:1; 428 unsigned int is_aux_task:1;
427 unsigned int aux_ready:1; 429 unsigned int aux_ready:1;
diff --git a/litmus/bheap.c b/litmus/bheap.c
index 528af97f18a6..45e1db36fa36 100644
--- a/litmus/bheap.c
+++ b/litmus/bheap.c
@@ -5,6 +5,8 @@ void bheap_init(struct bheap* heap)
5{ 5{
6 heap->head = NULL; 6 heap->head = NULL;
7 heap->min = NULL; 7 heap->min = NULL;
8
9// heap->size = 0;
8} 10}
9 11
10void bheap_node_init(struct bheap_node** _h, void* value) 12void bheap_node_init(struct bheap_node** _h, void* value)
@@ -173,6 +175,8 @@ void bheap_insert(bheap_prio_t higher_prio, struct bheap* heap,
173 heap->min = node; 175 heap->min = node;
174 } else 176 } else
175 __bheap_union(higher_prio, heap, node); 177 __bheap_union(higher_prio, heap, node);
178
179// ++heap->size;
176} 180}
177 181
178void bheap_uncache_min(bheap_prio_t higher_prio, struct bheap* heap) 182void bheap_uncache_min(bheap_prio_t higher_prio, struct bheap* heap)
@@ -195,6 +199,8 @@ void bheap_union(bheap_prio_t higher_prio,
195 __bheap_union(higher_prio, target, addition->head); 199 __bheap_union(higher_prio, target, addition->head);
196 /* this is a destructive merge */ 200 /* this is a destructive merge */
197 addition->head = NULL; 201 addition->head = NULL;
202
203// target->size += addition->size;
198} 204}
199 205
200struct bheap_node* bheap_peek(bheap_prio_t higher_prio, 206struct bheap_node* bheap_peek(bheap_prio_t higher_prio,
@@ -215,6 +221,9 @@ struct bheap_node* bheap_take(bheap_prio_t higher_prio,
215 heap->min = NULL; 221 heap->min = NULL;
216 if (node) 222 if (node)
217 node->degree = NOT_IN_HEAP; 223 node->degree = NOT_IN_HEAP;
224
225// --heap->size;
226
218 return node; 227 return node;
219} 228}
220 229
@@ -286,7 +295,10 @@ void bheap_delete(bheap_prio_t higher_prio, struct bheap* heap,
286 __bheap_union(higher_prio, heap, __bheap_reverse(node->child)); 295 __bheap_union(higher_prio, heap, __bheap_reverse(node->child));
287 } else 296 } else
288 heap->min = NULL; 297 heap->min = NULL;
298
289 node->degree = NOT_IN_HEAP; 299 node->degree = NOT_IN_HEAP;
300
301// --heap->size;
290} 302}
291 303
292/* allocate a heap node for value and insert into the heap */ 304/* allocate a heap node for value and insert into the heap */
diff --git a/litmus/budget.c b/litmus/budget.c
index 15de83bc584e..91755cf2787c 100644
--- a/litmus/budget.c
+++ b/litmus/budget.c
@@ -171,6 +171,11 @@ void sobliv_on_scheduled(struct task_struct* t)
171 arm_enforcement_timer(t); 171 arm_enforcement_timer(t);
172 } 172 }
173 } 173 }
174
175 if (tsk_rt(t)->inh_task) {
176 BUG_ON(is_running(tsk_rt(t)->inh_task));
177 tsk_rt(tsk_rt(t)->inh_task)->inh_task_linkback = t;
178 }
174} 179}
175 180
176void sobliv_on_blocked(struct task_struct* t) 181void sobliv_on_blocked(struct task_struct* t)
@@ -196,6 +201,25 @@ void sobliv_on_sleep(struct task_struct* t)
196 } 201 }
197} 202}
198 203
204void sobliv_on_inherit(struct task_struct* t, struct task_struct* prio_inh)
205{
206 BUG_ON(!prio_inh);
207
208 if (budget_precisely_tracked(t)) {
209 TRACE_TASK(t, "inheriting from %s/%d. stop draining own budget.\n",
210 prio_inh->comm, prio_inh->pid);
211 cancel_enforcement_timer(t);
212 }
213}
214
215void sobliv_on_disinherit(struct task_struct* t, struct task_struct* prio_inh)
216{
217 if (!prio_inh && budget_precisely_tracked(t)) {
218 TRACE_TASK(t, "assuming base priority. start draining own budget.\n");
219 arm_enforcement_timer(t);
220 }
221}
222
199 223
200static enum hrtimer_restart __on_timeout(struct hrtimer *timer) 224static enum hrtimer_restart __on_timeout(struct hrtimer *timer)
201{ 225{
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index fd1b80ac6090..64e04405dd32 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -440,6 +440,7 @@ static noinline void job_completion(struct task_struct *t, int forced)