diff options
author | Tanya Amert <tamert@cs.unc.edu> | 2020-10-14 19:43:14 -0400 |
---|---|---|
committer | Tanya Amert <tamert@cs.unc.edu> | 2020-10-14 19:43:14 -0400 |
commit | afdedce8c70f40340aa7ee7ad7a22a6faa15c473 (patch) | |
tree | f7a416973e5c6da0bfdf03424db7ee1e617f306d | |
parent | 12e066cc4bf815718ef311264a137c032afc214d (diff) |
Handled unlinked case in clear_priority_inheritance.
-rw-r--r-- | include/litmus/rt_domain.h | 5 | ||||
-rw-r--r-- | litmus/reservations/gedf_reservation.c | 36 | ||||
-rw-r--r-- | litmus/rt_domain.c | 2 |
3 files changed, 28 insertions, 15 deletions
diff --git a/include/litmus/rt_domain.h b/include/litmus/rt_domain.h index 691e2c15556c..3b3fd9d67ce7 100644 --- a/include/litmus/rt_domain.h +++ b/include/litmus/rt_domain.h | |||
@@ -73,6 +73,11 @@ void release_jobs_before_now(rt_domain_t* rt); | |||
73 | void domain_suspend_releases(rt_domain_t* rt); | 73 | void domain_suspend_releases(rt_domain_t* rt); |
74 | void domain_resume_releases(rt_domain_t* rt); | 74 | void domain_resume_releases(rt_domain_t* rt); |
75 | 75 | ||
76 | /* caller must hold release lock */ | ||
77 | struct release_heap* get_release_heap_res(rt_domain_t *rt, | ||
78 | struct reservation* res, | ||
79 | int use_task_heap); | ||
80 | |||
76 | static inline struct task_struct* __next_ready(rt_domain_t* rt) | 81 | static inline struct task_struct* __next_ready(rt_domain_t* rt) |
77 | { | 82 | { |
78 | struct bheap_node *hn = bheap_peek(rt->order, &rt->ready_queue); | 83 | struct bheap_node *hn = bheap_peek(rt->order, &rt->ready_queue); |
diff --git a/litmus/reservations/gedf_reservation.c b/litmus/reservations/gedf_reservation.c index 27aee598b6f4..cb38ba33dbb1 100644 --- a/litmus/reservations/gedf_reservation.c +++ b/litmus/reservations/gedf_reservation.c | |||
@@ -727,9 +727,6 @@ static void set_priority_inheritance(struct task_struct* t, struct task_struct* | |||
727 | 727 | ||
728 | raw_spin_lock(&gedf_env->domain.ready_lock); | 728 | raw_spin_lock(&gedf_env->domain.ready_lock); |
729 | 729 | ||
730 | printk("Task %d had inherited prio=%llu, now will be prio=%llu\n", | ||
731 | t->pid, t_res->inh_res ? t_res->inh_res->priority : 0, | ||
732 | prio_inh_res->priority); | ||
733 | TRACE_TASK(t, "inherits priority from %s/%d\n", prio_inh->comm, prio_inh->pid); | 730 | TRACE_TASK(t, "inherits priority from %s/%d\n", prio_inh->comm, prio_inh->pid); |
734 | t_res->inh_res = prio_inh_res; | 731 | t_res->inh_res = prio_inh_res; |
735 | 732 | ||
@@ -765,19 +762,30 @@ static void clear_priority_inheritance(struct task_struct* t) | |||
765 | BUG_ON(!gedf_res->linked_on && !bheap_node_in_heap(t_res->heap_node)); | 762 | BUG_ON(!gedf_res->linked_on && !bheap_node_in_heap(t_res->heap_node)); |
766 | 763 | ||
767 | /* Check if rescheduling is necessary. We can't use heap_decrease() | 764 | /* Check if rescheduling is necessary. We can't use heap_decrease() |
768 | * since the priority was effectively lowered. */ | 765 | * since the priority was effectively lowered. Instead, we |
769 | 766 | * update the position of the CPU on which it is linked. | |
770 | /* assumes high_res_prio in ext_reservation.c takes into account inh_task when doing prio comparisons */ | 767 | * only need to update the cpu position in heap to reflect gedf_res's |
771 | /* only need to update the cpu position in heap to reflect gedf_res's change in prio. | 768 | * change in prio. This only affects the cpu_heap when gedf_res |
772 | * This only affects the cpu_heap when gedf_res is linked on a cpu and only on the cpu | 769 | * is linked on a cpu and only on the cpu that it's linked on. */ |
773 | * that it's linked on | 770 | if (gedf_res->linked_on) { |
774 | */ | ||
775 | if (gedf_res->linked_on) | ||
776 | update_cpu_position(gedf_res->linked_on, &gedf_env->cpu_heap); | 771 | update_cpu_position(gedf_res->linked_on, &gedf_env->cpu_heap); |
777 | check_for_preemptions(gedf_env); | 772 | } |
773 | else { | ||
774 | struct bheap *heap; | ||
775 | if (t_res->replenishment_time > litmus_clock()) { | ||
776 | raw_spin_lock(&gedf_env->domain.release_lock); | ||
777 | heap = &(get_release_heap_res(&gedf_env->domain, t_res, 0)->heap); | ||
778 | raw_spin_unlock(&gedf_env->domain.release_lock); | ||
779 | } | ||
780 | else { | ||
781 | heap = &(gedf_env->domain.ready_queue); | ||
782 | } | ||
778 | 783 | ||
779 | // TODO tamert: reschedule if necessary | 784 | bheap_delete(edf_ready_order, heap, t_res->heap_node); |
780 | // (the priority was effectively lowered) | 785 | bheap_insert(edf_ready_order, heap, t_res->heap_node); |
786 | } | ||
787 | |||
788 | check_for_preemptions(gedf_env); | ||
781 | 789 | ||
782 | raw_spin_unlock(&gedf_env->domain.ready_lock); | 790 | raw_spin_unlock(&gedf_env->domain.ready_lock); |
783 | } | 791 | } |
diff --git a/litmus/rt_domain.c b/litmus/rt_domain.c index db3a48bff0d0..0e54e2c48d84 100644 --- a/litmus/rt_domain.c +++ b/litmus/rt_domain.c | |||
@@ -202,7 +202,7 @@ static struct release_heap* __get_release_heap(rt_domain_t *rt, | |||
202 | return heap; | 202 | return heap; |
203 | } | 203 | } |
204 | 204 | ||
205 | static struct release_heap* get_release_heap_res(rt_domain_t *rt, | 205 | struct release_heap* get_release_heap_res(rt_domain_t *rt, |
206 | struct reservation* res, | 206 | struct reservation* res, |
207 | int use_task_heap) | 207 | int use_task_heap) |
208 | { | 208 | { |