aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/bheap.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2013-04-04 17:31:30 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2013-04-04 17:37:06 -0400
commitb379666c96805563ca61ddfbb38f0ec9809edf05 (patch)
tree6f0b64b1aa70b76e4db0e6786629b985a61dbefe /litmus/bheap.c
parent3324865fc5792b9d755d46cafa42c74b5037bba5 (diff)
Proper sobliv draining and many bug fixes.wip-2012.3-gpu-sobliv-budget-w-kshark
Proper sobliv draining: Always and only drain budget from a task if its BASE priority is among the top m processors in the cluster. This required some work with timers and tracking of consumed budget while a task is suspended (since the Linux rq won't track this for us). Had to introduce a number of hacks and kludges to make this work in the required timeframe: 1) C-EDF's ready queue lock becomes recursive (yuck!) 2) Extend bheap with a for_each visitor function. This is needed to set a timer for each newly released job. 3) Dual-binary heap structure in C-EDF to divide jobs into top-m and not-top-m tasks. 4) Restructured the budget plugin API. Unfortunatly, there is not a lot of overlap between SIMPLE and SOBLIV draining policies.
Diffstat (limited to 'litmus/bheap.c')
-rw-r--r--litmus/bheap.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/litmus/bheap.c b/litmus/bheap.c
index 403c09cc9e81..c69d75c28aaf 100644
--- a/litmus/bheap.c
+++ b/litmus/bheap.c
@@ -5,8 +5,6 @@ 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;
10} 8}
11 9
12void bheap_node_init(struct bheap_node** _h, void* value) 10void bheap_node_init(struct bheap_node** _h, void* value)
@@ -21,19 +19,19 @@ void bheap_node_init(struct bheap_node** _h, void* value)
21} 19}
22 20
23 21
24static void __bheap_for_all(struct bheap_node *h, bheap_for_all_t fn, void* args) 22static void __bheap_for_each(struct bheap_node *h, bheap_for_each_t fn, void* args)
25{ 23{
26 /* pre-order */ 24 /* pre-order */
27 fn(h, args); 25 fn(h, args);
28 26
29 /* depth-first */ 27 /* depth-first */
30 if (h->child) 28 if (h->child)
31 __bheap_for_all(h->child, fn, args); 29 __bheap_for_each(h->child, fn, args);
32 if (h->next) 30 if (h->next)
33 __bheap_for_all(h->next, fn, args); 31 __bheap_for_each(h->next, fn, args);
34} 32}
35 33
36void bheap_for_all(struct bheap* heap, bheap_for_all_t fn, void* args) 34void bheap_for_each(struct bheap* heap, bheap_for_each_t fn, void* args)
37{ 35{
38 struct bheap_node *head; 36 struct bheap_node *head;
39 37
@@ -41,7 +39,7 @@ void bheap_for_all(struct bheap* heap, bheap_for_all_t fn, void* args)
41 BUG_ON(!fn); 39 BUG_ON(!fn);
42 40
43 head = heap->head; 41 head = heap->head;
44 __bheap_for_all(head, fn, args); 42 __bheap_for_each(head, fn, args);
45} 43}
46 44
47/* make child a subtree of root */ 45/* make child a subtree of root */
@@ -198,8 +196,6 @@ void bheap_insert(bheap_prio_t higher_prio, struct bheap* heap,
198 heap->min = node; 196 heap->min = node;
199 } else 197 } else
200 __bheap_union(higher_prio, heap, node); 198 __bheap_union(higher_prio, heap, node);
201
202// ++heap->size;
203} 199}
204 200
205void bheap_uncache_min(bheap_prio_t higher_prio, struct bheap* heap) 201void bheap_uncache_min(bheap_prio_t higher_prio, struct bheap* heap)
@@ -222,8 +218,6 @@ void bheap_union(bheap_prio_t higher_prio,
222 __bheap_union(higher_prio, target, addition->head); 218 __bheap_union(higher_prio, target, addition->head);
223 /* this is a destructive merge */ 219 /* this is a destructive merge */
224 addition->head = NULL; 220 addition->head = NULL;
225
226// target->size += addition->size;
227} 221}
228 222
229struct bheap_node* bheap_peek(bheap_prio_t higher_prio, 223struct bheap_node* bheap_peek(bheap_prio_t higher_prio,
@@ -245,8 +239,6 @@ struct bheap_node* bheap_take(bheap_prio_t higher_prio,
245 if (node) 239 if (node)
246 node->degree = NOT_IN_HEAP; 240 node->degree = NOT_IN_HEAP;
247 241
248// --heap->size;
249
250 return node; 242 return node;
251} 243}
252 244
@@ -320,8 +312,6 @@ void bheap_delete(bheap_prio_t higher_prio, struct bheap* heap,
320 heap->min = NULL; 312 heap->min = NULL;
321 313
322 node->degree = NOT_IN_HEAP; 314 node->degree = NOT_IN_HEAP;
323
324// --heap->size;
325} 315}
326 316
327/* allocate a heap node for value and insert into the heap */ 317/* allocate a heap node for value and insert into the heap */