aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJohn M. Calandrino <jmc@jupiter-cs.cs.unc.edu>2007-04-23 17:02:30 -0400
committerJohn M. Calandrino <jmc@jupiter-cs.cs.unc.edu>2007-04-23 17:02:30 -0400
commitf6f293bee0fd39c2ffe3cd945da961f1470ad52c (patch)
tree35cad69787bcde37b9c31376a7b609f28277661d /kernel
parentca16fd5c25326ebaf3672155df7058d98cade764 (diff)
Fixed priority inheritance issues with PI semaphores. Added regular
semaphores accessible through system calls, so that they can be used with the LSO (for partitioned FMLP).
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 379b71bc47..b9bcda8fb7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1628,7 +1628,8 @@ void fastcall sched_fork(struct task_struct *p, int clone_flags)
1628 INIT_LIST_HEAD(&p->rt_list); 1628 INIT_LIST_HEAD(&p->rt_list);
1629 p->rt_param.basic_params.class = RT_CLASS_BEST_EFFORT; 1629 p->rt_param.basic_params.class = RT_CLASS_BEST_EFFORT;
1630 p->rt_param.litmus_controlled = 0; 1630 p->rt_param.litmus_controlled = 0;
1631 p->rt_param.has_resource = 0; 1631 p->rt_param.released_pi_sem = 0;
1632 p->rt_param.inh_task = NULL;
1632 p->rt_param.waiting_to_exit_zone = 0; 1633 p->rt_param.waiting_to_exit_zone = 0;
1633 p->array = NULL; 1634 p->array = NULL;
1634#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1635#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
@@ -3813,8 +3814,6 @@ static void __pi_wake_up_common(struct pi_semaphore *s, unsigned int mode,
3813 int nr_exclusive, int sync, void *key) 3814 int nr_exclusive, int sync, void *key)
3814{ 3815{
3815 struct list_head *tmp, *next; 3816 struct list_head *tmp, *next;
3816 jiffie_t task_prio;
3817 jiffie_t highest_prio = LOWEST_SEM_PRIO;
3818 3817
3819 /* First pass: wakeup tasks. */ 3818 /* First pass: wakeup tasks. */
3820 list_for_each_safe(tmp, next, &s->wait.task_list) { 3819 list_for_each_safe(tmp, next, &s->wait.task_list) {
@@ -3826,25 +3825,30 @@ static void __pi_wake_up_common(struct pi_semaphore *s, unsigned int mode,
3826 break; 3825 break;
3827 } 3826 }
3828 3827
3829 /* Second pass: find highest-priority sleeping task. */ 3828 /* Second pass: find highest-priority sleeping task,
3830 list_for_each_safe(tmp, next, &s->wait.task_list) { 3829 * _if current task is the current sem_hp_task_.
3831 wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list); 3830 */
3832 3831 if (current == s->sem_hp_task) {
3833 /* Compare task priorities, find highest (earliest d/l). */ 3832 s->sem_hp_task = NULL;
3834 task_prio = ((struct task_struct *)curr->private)->rt_param.times.deadline; 3833 list_for_each_safe(tmp, next, &s->wait.task_list) {
3835 if (time_before(task_prio, highest_prio)) { 3834 wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list);
3836 highest_prio = task_prio; 3835
3836 /* Compare task priorities, find highest priority task. */
3837 if (!s->sem_hp_task ||
3838 time_before(((struct task_struct *)curr->private)->rt_param.times.deadline,
3839 s->sem_hp_task->rt_param.times.deadline) ||
3840 (((struct task_struct *)curr->private)->rt_param.times.deadline ==
3841 s->sem_hp_task->rt_param.times.deadline &&
3842 ((struct task_struct *)curr->private)->pid < s->sem_hp_task->pid))
3843 s->sem_hp_task = (struct task_struct *)curr->private;
3837 } 3844 }
3838 } 3845 }
3839 3846
3840 /* 3847 /* Reset inh_task to NULL, and set flag indicating that you just
3841 * Set new priority to that of highest priority 3848 * released a PI semaphore.
3842 * task remaining in waitqueue.
3843 */ 3849 */
3844 s->sem_prio = highest_prio; 3850 current->rt_param.inh_task = NULL;
3845 3851 current->rt_param.released_pi_sem = 1;
3846 /* Remove flag indicating that you should use semaphore priority. */
3847 current->rt_param.has_resource = 0;
3848} 3852}
3849 3853
3850/** 3854/**