Skip to content

Commit a7d656d

Browse files
authored
Merge pull request #313 from xiulipan/schfix
fix some potential bugs in scheduler
2 parents 90b455e + 8c3917d commit a7d656d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/lib/schedule.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ static inline struct task *edf_get_next(uint64_t current,
141141
trace_pipe("ed!");
142142

143143
/* have we already tried to rescheule ? */
144-
if (reschedule++)
144+
if (!reschedule) {
145+
reschedule++;
146+
trace_pipe("edr");
145147
edf_reschedule(task, current);
146-
else {
148+
} else {
147149
/* reschedule failed */
148150
list_item_del(&task->list);
149151
task->state = TASK_STATE_CANCEL;
@@ -267,6 +269,13 @@ static int _schedule_task(struct task *task, uint64_t start, uint64_t deadline)
267269
return 0;
268270
}
269271

272+
/* is task already running ? - not enough MIPS to complete ? */
273+
if (task->state == TASK_STATE_QUEUED) {
274+
trace_pipe("tsq");
275+
spin_unlock_irq(&sch->lock, flags);
276+
return 0;
277+
}
278+
270279
/* get the current time */
271280
current = platform_timer_get(platform_timer);
272281

0 commit comments

Comments
 (0)