aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJohn M. Calandrino <jmc@jupiter-cs.cs.unc.edu>2007-04-18 11:28:06 -0400
committerJohn M. Calandrino <jmc@jupiter-cs.cs.unc.edu>2007-04-18 11:28:06 -0400
commit882253a1054313258d7209b60af0e9c2a1e5e80e (patch)
tree6b4fb5a061d0f1920b00e0efccd46ed657835110 /kernel
parent4838ef57bb645fcf41c0a33b3c08ea97680e4307 (diff)
Added priority inheritance within semaphores - compiles but has not been
tested.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 27dcab489b..4341c1881b 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3811,26 +3811,35 @@ static void __pi_wake_up_common(struct pi_semaphore *s, unsigned int mode,
3811 int nr_exclusive, int sync, void *key) 3811 int nr_exclusive, int sync, void *key)
3812{ 3812{
3813 struct list_head *tmp, *next; 3813 struct list_head *tmp, *next;
3814 jiffie_t task_prio;
3814 jiffie_t highest_prio = LOWEST_SEM_PRIO; 3815 jiffie_t highest_prio = LOWEST_SEM_PRIO;
3815 3816
3817 /* First pass: wakeup tasks. */
3816 list_for_each_safe(tmp, next, &s->wait.task_list) { 3818 list_for_each_safe(tmp, next, &s->wait.task_list) {
3817 wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list); 3819 wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list);
3818 unsigned flags = curr->flags; 3820 unsigned flags = curr->flags;
3819 3821
3820 /* TODO: Find highest priority task remaining in queue. */
3821 /* task_priority = tmp_task->rt_param.times.deadline;
3822 * if (time_before(task_priority, highest_prio)) {
3823 * highest_prio = task_priority;
3824 * }
3825 */
3826
3827 if (curr->func(curr, mode, sync, key) && 3822 if (curr->func(curr, mode, sync, key) &&
3828 (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive) 3823 (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
3829 break; 3824 break;
3830 } 3825 }
3831 3826
3832 /* TODO: Set new priority to highest priority task remaining in queue. */ 3827 /* Second pass: find highest-priority sleeping task. */
3833 /* s->sem_prio = highest_prio; */ 3828 list_for_each_safe(tmp, next, &s->wait.task_list) {
3829 wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list);
3830
3831 /* Compare task priorities, find highest (earliest d/l). */
3832 task_prio = ((struct task_struct *)curr->private)->rt_param.times.deadline;
3833 if (time_before(task_prio, highest_prio)) {
3834 highest_prio = task_prio;
3835 }
3836 }
3837
3838 /*
3839 * Set new priority to that of highest priority
3840 * task remaining in waitqueue.
3841 */
3842 s->sem_prio = highest_prio;
3834} 3843}
3835 3844
3836/** 3845/**