diff options
Diffstat (limited to 'litmus/sched_pfp.c')
-rw-r--r-- | litmus/sched_pfp.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/litmus/sched_pfp.c b/litmus/sched_pfp.c index 91e52391a173..a96c2b1aa26f 100644 --- a/litmus/sched_pfp.c +++ b/litmus/sched_pfp.c | |||
@@ -142,17 +142,25 @@ static void pfp_tick(struct task_struct *t) | |||
142 | */ | 142 | */ |
143 | BUG_ON(is_realtime(t) && t != pfp->scheduled); | 143 | BUG_ON(is_realtime(t) && t != pfp->scheduled); |
144 | 144 | ||
145 | if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) { | 145 | if (is_realtime(t) && budget_exhausted(t)) |
146 | if (!is_np(t)) { | 146 | { |
147 | litmus_reschedule_local(); | 147 | if (budget_signalled(t) && !sigbudget_sent(t)) { |
148 | TRACE("pfp_scheduler_tick: " | 148 | /* signal exhaustion */ |
149 | "%d is preemptable " | 149 | send_sigbudget(t); |
150 | " => FORCE_RESCHED\n", t->pid); | 150 | } |
151 | } else if (is_user_np(t)) { | 151 | |
152 | TRACE("pfp_scheduler_tick: " | 152 | if (budget_enforced(t)) { |
153 | "%d is non-preemptable, " | 153 | if (!is_np(t)) { |
154 | "preemption delayed.\n", t->pid); | 154 | litmus_reschedule_local(); |
155 | request_exit_np(t); | 155 | TRACE("pfp_scheduler_tick: " |
156 | "%d is preemptable " | ||
157 | " => FORCE_RESCHED\n", t->pid); | ||
158 | } else if (is_user_np(t)) { | ||
159 | TRACE("pfp_scheduler_tick: " | ||
160 | "%d is non-preemptable, " | ||
161 | "preemption delayed.\n", t->pid); | ||
162 | request_exit_np(t); | ||
163 | } | ||
156 | } | 164 | } |
157 | } | 165 | } |
158 | } | 166 | } |
@@ -162,7 +170,7 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) | |||
162 | pfp_domain_t* pfp = local_pfp; | 170 | pfp_domain_t* pfp = local_pfp; |
163 | struct task_struct* next; | 171 | struct task_struct* next; |
164 | 172 | ||
165 | int out_of_time, sleep, preempt, np, exists, blocks, resched, migrate; | 173 | int out_of_time, signal_budget, sleep, preempt, np, exists, blocks, resched, migrate; |
166 | 174 | ||
167 | raw_spin_lock(&pfp->slock); | 175 | raw_spin_lock(&pfp->slock); |
168 | 176 | ||
@@ -179,6 +187,10 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) | |||
179 | out_of_time = exists && | 187 | out_of_time = exists && |
180 | budget_enforced(pfp->scheduled) && | 188 | budget_enforced(pfp->scheduled) && |
181 | budget_exhausted(pfp->scheduled); | 189 | budget_exhausted(pfp->scheduled); |
190 | signal_budget = exists && | ||
191 | budget_signalled(pfp->scheduled) && | ||
192 | budget_exhausted(pfp->scheduled) && | ||
193 | !sigbudget_sent(pfp->scheduled); | ||
182 | np = exists && is_np(pfp->scheduled); | 194 | np = exists && is_np(pfp->scheduled); |
183 | sleep = exists && is_completed(pfp->scheduled); | 195 | sleep = exists && is_completed(pfp->scheduled); |
184 | migrate = exists && get_partition(pfp->scheduled) != pfp->cpu; | 196 | migrate = exists && get_partition(pfp->scheduled) != pfp->cpu; |
@@ -190,6 +202,10 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) | |||
190 | */ | 202 | */ |
191 | resched = preempt; | 203 | resched = preempt; |
192 | 204 | ||
205 | /* Send the signal that the budget has been exhausted */ | ||
206 | if (signal_budget) | ||
207 | send_sigbudget(pfp->scheduled); | ||
208 | |||
193 | /* If a task blocks we have no choice but to reschedule. | 209 | /* If a task blocks we have no choice but to reschedule. |
194 | */ | 210 | */ |
195 | if (blocks) | 211 | if (blocks) |