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 62be699629b1..6129eb94d3ea 100644 --- a/litmus/sched_pfp.c +++ b/litmus/sched_pfp.c | |||
@@ -135,17 +135,25 @@ static void pfp_tick(struct task_struct *t) | |||
135 | */ | 135 | */ |
136 | BUG_ON(is_realtime(t) && t != pfp->scheduled); | 136 | BUG_ON(is_realtime(t) && t != pfp->scheduled); |
137 | 137 | ||
138 | if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) { | 138 | if (is_realtime(t) && budget_exhausted(t)) |
139 | if (!is_np(t)) { | 139 | { |
140 | litmus_reschedule_local(); | 140 | if (budget_signalled(t) && !sigbudget_sent(t)) { |
141 | TRACE("pfp_scheduler_tick: " | 141 | /* signal exhaustion */ |
142 | "%d is preemptable " | 142 | send_sigbudget(t); |
143 | " => FORCE_RESCHED\n", t->pid); | 143 | } |
144 | } else if (is_user_np(t)) { | 144 | |
145 | TRACE("pfp_scheduler_tick: " | 145 | if (budget_enforced(t)) { |
146 | "%d is non-preemptable, " | 146 | if (!is_np(t)) { |
147 | "preemption delayed.\n", t->pid); | 147 | litmus_reschedule_local(); |
148 | request_exit_np(t); | 148 | TRACE("pfp_scheduler_tick: " |
149 | "%d is preemptable " | ||
150 | " => FORCE_RESCHED\n", t->pid); | ||
151 | } else if (is_user_np(t)) { | ||
152 | TRACE("pfp_scheduler_tick: " | ||
153 | "%d is non-preemptable, " | ||
154 | "preemption delayed.\n", t->pid); | ||
155 | request_exit_np(t); | ||
156 | } | ||
149 | } | 157 | } |
150 | } | 158 | } |
151 | } | 159 | } |
@@ -155,7 +163,7 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) | |||
155 | pfp_domain_t* pfp = local_pfp; | 163 | pfp_domain_t* pfp = local_pfp; |
156 | struct task_struct* next; | 164 | struct task_struct* next; |
157 | 165 | ||
158 | int out_of_time, sleep, preempt, np, exists, blocks, resched, migrate; | 166 | int out_of_time, signal_budget, sleep, preempt, np, exists, blocks, resched, migrate; |
159 | 167 | ||
160 | raw_spin_lock(&pfp->slock); | 168 | raw_spin_lock(&pfp->slock); |
161 | 169 | ||
@@ -172,6 +180,10 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) | |||
172 | out_of_time = exists && | 180 | out_of_time = exists && |
173 | budget_enforced(pfp->scheduled) && | 181 | budget_enforced(pfp->scheduled) && |
174 | budget_exhausted(pfp->scheduled); | 182 | budget_exhausted(pfp->scheduled); |
183 | signal_budget = exists && | ||
184 | budget_signalled(pfp->scheduled) && | ||
185 | budget_exhausted(pfp->scheduled) && | ||
186 | !sigbudget_sent(pfp->scheduled); | ||
175 | np = exists && is_np(pfp->scheduled); | 187 | np = exists && is_np(pfp->scheduled); |
176 | sleep = exists && get_rt_flags(pfp->scheduled) == RT_F_SLEEP; | 188 | sleep = exists && get_rt_flags(pfp->scheduled) == RT_F_SLEEP; |
177 | migrate = exists && get_partition(pfp->scheduled) != pfp->cpu; | 189 | migrate = exists && get_partition(pfp->scheduled) != pfp->cpu; |
@@ -183,6 +195,10 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) | |||
183 | */ | 195 | */ |
184 | resched = preempt; | 196 | resched = preempt; |
185 | 197 | ||
198 | /* Send the signal that the budget has been exhausted */ | ||
199 | if (signal_budget) | ||
200 | send_sigbudget(pfp->scheduled); | ||
201 | |||
186 | /* If a task blocks we have no choice but to reschedule. | 202 | /* If a task blocks we have no choice but to reschedule. |
187 | */ | 203 | */ |
188 | if (blocks) | 204 | if (blocks) |