diff options
-rw-r--r-- | litmus/ikglp_lock.c | 107 |
1 files changed, 3 insertions, 104 deletions
diff --git a/litmus/ikglp_lock.c b/litmus/ikglp_lock.c index 57be5db5f1be..fe242c789318 100644 --- a/litmus/ikglp_lock.c +++ b/litmus/ikglp_lock.c | |||
@@ -629,6 +629,9 @@ static void ikglp_get_immediate(struct task_struct* t, | |||
629 | 629 | ||
630 | ++(fq->count); | 630 | ++(fq->count); |
631 | 631 | ||
632 | // even though we got the replica, we're still considered in the fifo | ||
633 | ++(sem->nr_in_fifos); | ||
634 | |||
632 | ikglp_add_global_list(sem, t, &fq->global_heap_node); | 635 | ikglp_add_global_list(sem, t, &fq->global_heap_node); |
633 | ikglp_add_donees(sem, fq, t, &fq->donee_heap_node); | 636 | ikglp_add_donees(sem, fq, t, &fq->donee_heap_node); |
634 | 637 | ||
@@ -1014,110 +1017,6 @@ acquired: | |||
1014 | return replica; | 1017 | return replica; |
1015 | } | 1018 | } |
1016 | 1019 | ||
1017 | //int ikglp_lock(struct litmus_lock* l) | ||
1018 | //{ | ||
1019 | // struct task_struct* t = current; | ||
1020 | // struct ikglp_semaphore *sem = ikglp_from_lock(l); | ||
1021 | // unsigned long flags = 0, real_flags; | ||
1022 | // struct fifo_queue *fq = NULL; | ||
1023 | // int replica = -EINVAL; | ||
1024 | // | ||
1025 | //#ifdef CONFIG_LITMUS_DGL_SUPPORT | ||
1026 | // raw_spinlock_t *dgl_lock; | ||
1027 | //#endif | ||
1028 | // | ||
1029 | // ikglp_wait_state_t wait; | ||
1030 | // | ||
1031 | // if (!is_realtime(t)) | ||
1032 | // return -EPERM; | ||
1033 | // | ||
1034 | //#ifdef CONFIG_LITMUS_DGL_SUPPORT | ||
1035 | // dgl_lock = litmus->get_dgl_spinlock(t); | ||
1036 | //#endif | ||
1037 | // | ||
1038 | // raw_spin_lock_irqsave(&sem->real_lock, real_flags); | ||
1039 | // | ||
1040 | // lock_global_irqsave(dgl_lock, flags); | ||
1041 | // lock_fine_irqsave(&sem->lock, flags); | ||
1042 | // | ||
1043 | // | ||
1044 | //#ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
1045 | // fq = (sem->aff_obs) ? | ||
1046 | // sem->aff_obs->ops->advise_enqueue(sem->aff_obs, t) : | ||
1047 | // sem->shortest_fifo_queue; | ||
1048 | //#else | ||
1049 | // fq = sem->shortest_fifo_queue; | ||
1050 | //#endif | ||
1051 | // | ||
1052 | // if(fq->count == 0) { | ||
1053 | // // take available resource | ||
1054 | // replica = ikglp_get_idx(sem, fq); | ||
1055 | // | ||
1056 | // ikglp_get_immediate(t, fq, sem, flags); // unlocks sem->lock | ||
1057 | // | ||
1058 | // unlock_global_irqrestore(dgl_lock, flags); | ||
1059 | // raw_spin_unlock_irqrestore(&sem->real_lock, real_flags); | ||
1060 | // } | ||
1061 | // else | ||
1062 | // { | ||
1063 | // // we have to suspend. | ||
1064 | // | ||
1065 | // wait.task = t; // THIS IS CRITICALLY IMPORTANT!!! | ||
1066 | // | ||
1067 | // tsk_rt(t)->blocked_lock = (struct litmus_lock*)sem; // record where we are blocked | ||
1068 | // mb(); | ||
1069 | // | ||
1070 | // /* FIXME: interruptible would be nice some day */ | ||
1071 | // set_task_state(t, TASK_UNINTERRUPTIBLE); | ||
1072 | // | ||
1073 | // if(fq->count < sem->max_fifo_len) { | ||
1074 | // // enqueue on fq | ||
1075 | // ikglp_enqueue_on_fq(sem, fq, &wait, flags); // unlocks sem->lock | ||
1076 | // } | ||
1077 | // else { | ||
1078 | // | ||
1079 | // TRACE_CUR("IKGLP fifo queues are full (at least they better be).\n"); | ||
1080 | // | ||
1081 | // // no room in fifos. Go to PQ or donors. | ||
1082 | // | ||
1083 | // if(litmus->__compare(ikglp_mth_highest(sem), BASE, t, BASE)) { | ||
1084 | // // enqueue on PQ | ||
1085 | // ikglp_enqueue_on_pq(sem, &wait); | ||
1086 | // unlock_fine_irqrestore(&sem->lock, flags); | ||
1087 | // } | ||
1088 | // else { | ||
1089 | // // enqueue as donor | ||
1090 | // ikglp_enqueue_on_donor(sem, &wait, flags); // unlocks sem->lock | ||
1091 | // } | ||
1092 | // } | ||
1093 | // | ||
1094 | // unlock_global_irqrestore(dgl_lock, flags); | ||
1095 | // raw_spin_unlock_irqrestore(&sem->real_lock, real_flags); | ||
1096 | // | ||
1097 | // TS_LOCK_SUSPEND; | ||
1098 | // | ||
1099 | // schedule(); | ||
1100 | // | ||
1101 | // TS_LOCK_RESUME; | ||
1102 | // | ||
1103 | // fq = ikglp_get_queue(sem, t); | ||
1104 | // BUG_ON(!fq); | ||
1105 | // | ||
1106 | // replica = ikglp_get_idx(sem, fq); | ||
1107 | // } | ||
1108 | // | ||
1109 | // TRACE_CUR("Acquired lock %d, queue %d\n", | ||
1110 | // l->ident, replica); | ||
1111 | // | ||
1112 | //#ifdef CONFIG_LITMUS_AFFINITY_LOCKING | ||
1113 | // if(sem->aff_obs) { | ||
1114 | // return sem->aff_obs->ops->replica_to_resource(sem->aff_obs, fq); | ||
1115 | // } | ||
1116 | //#endif | ||
1117 | // | ||
1118 | // return replica; | ||
1119 | //} | ||
1120 | |||
1121 | static void ikglp_move_donor_to_fq(struct ikglp_semaphore *sem, | 1020 | static void ikglp_move_donor_to_fq(struct ikglp_semaphore *sem, |
1122 | struct fifo_queue *fq, | 1021 | struct fifo_queue *fq, |
1123 | ikglp_wait_state_t *donor_info) | 1022 | ikglp_wait_state_t *donor_info) |