aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2013-05-02 16:42:06 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2013-05-02 16:42:06 -0400
commitbe1e926439953fc3ba403c28c37c0c8128567a4e (patch)
tree7c3f6269a2f5bafe7ee5420c7a7cc8e587259a26
parent9a026024e4f64d198427bf485eec75b14011d331 (diff)
Improve precision and optimizations
-rw-r--r--include/litmus/rt_param.h4
-rw-r--r--litmus/sched_edf_os.c37
2 files changed, 21 insertions, 20 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index b741645c4e59..74210f3b362e 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -62,12 +62,8 @@ struct edffm_params {
62}; 62};
63 63
64struct edfos_params { 64struct edfos_params {
65 /* EDF-os where can a migratory task execute? */
66 unsigned int cpus[NR_CPUS];
67 /* Whether this task is a migrating task*/ 65 /* Whether this task is a migrating task*/
68 unsigned int migrat; 66 unsigned int migrat;
69 /* ID of the first or only CPU*/
70 unsigned int first_cpu;
71 /* Time of next subtask release or deadline */ 67 /* Time of next subtask release or deadline */
72 int heap_data[NR_CPUS]; 68 int heap_data[NR_CPUS];
73 /* Fraction of this task exec_cost that each CPU should handle. 69 /* Fraction of this task exec_cost that each CPU should handle.
diff --git a/litmus/sched_edf_os.c b/litmus/sched_edf_os.c
index d263f8ca7faf..1c633b591412 100644
--- a/litmus/sched_edf_os.c
+++ b/litmus/sched_edf_os.c
@@ -258,27 +258,29 @@ static void update_job_counter(struct task_struct *t)
258} 258}
259 259
260 260
261static int compute_pfair_deadline(unsigned int wt_num, unsigned int wt_den, 261static int compute_pfair_deadline(lt_t wt_num, lt_t wt_den,
262 unsigned int job_no) 262 unsigned int job_no)
263{ 263{
264 unsigned int num, den, dead; 264 lt_t num;
265 num = job_no * wt_den; 265 num = job_no * wt_den;
266 den = wt_num; 266 if (do_div(num, wt_num))
267 dead = num / den; 267 num++;
268 if (num % den > 0) 268 return (int)num;
269 dead++;
270 return dead;
271} 269}
272 270
273static int compute_pfair_release(unsigned int wt_num, unsigned int wt_den, 271static int compute_pfair_release(lt_t wt_num, lt_t wt_den,
274 unsigned int job_no) 272 unsigned int job_no)
275{ 273{
276 return ((job_no - 1) * wt_den) / wt_num; 274 lt_t num;
275 num = (job_no - 1) * wt_den;
276 do_div(num, wt_num);
277 return (int)num;
277} 278}
278 279
279static int next_cpu_for_job(struct task_struct *t) 280static int next_cpu_for_job(struct task_struct *t)
280{ 281{
281 unsigned int cpu, next_rel; 282 unsigned int cpu;
283 lt_t next_rel;
282 struct bheap_node* node; 284 struct bheap_node* node;
283 BUG_ON(!is_migrat_task(t)); 285 BUG_ON(!is_migrat_task(t));
284 286
@@ -483,12 +485,15 @@ static void edfos_task_new(struct task_struct * t, int on_rq, int running)
483 485
484 for (i = 0; i < NR_CPUS; i++) 486 for (i = 0; i < NR_CPUS; i++)
485 { 487 {
486 edfos_params(t).heap_data[i] = compute_pfair_deadline( 488 if (edfos_params(t).fraction[0][i] > 0)
487 edfos_params(t).fraction[0][i], 489 {
488 edfos_params(t).fraction[1][i], 490 edfos_params(t).heap_data[i] = compute_pfair_deadline(
489 0); 491 edfos_params(t).fraction[0][i],
490 bheap_add(fakepfair_ready_order, &edfos_params(t).ready_queue, 492 edfos_params(t).fraction[1][i], 0);
491 &edfos_params(t).heap_data[i], GFP_ATOMIC); 493 bheap_add(fakepfair_ready_order,
494 &edfos_params(t).ready_queue,
495 &edfos_params(t).heap_data[i], GFP_ATOMIC);
496 }
492 } 497 }
493 /* Pick the first CPU to execute on. */ 498 /* Pick the first CPU to execute on. */
494 change_migrat_cpu_if_needed(t); 499 change_migrat_cpu_if_needed(t);