Index: linux-2.6.30-bfs/kernel/sched_bfs.c =================================================================== --- linux-2.6.30-bfs.orig/kernel/sched_bfs.c 2009-09-05 07:46:01.284839623 +1000 +++ linux-2.6.30-bfs/kernel/sched_bfs.c 2009-09-05 07:56:38.609964516 +1000 @@ -1836,7 +1836,7 @@ return (prio_ratio(p) * rr_interval * HZ / 1000 / 100) ? : 1; } -static inline int longest_deadline(void) +static inline long longest_deadline(void) { return (prio_ratios[39] * rr_interval * HZ / 1000 / 100); } @@ -1868,7 +1868,6 @@ static inline struct task_struct *earliest_deadline_task(struct rq *rq, struct task_struct *idle) { - unsigned long long_deadline, shortest_deadline; struct task_struct *edt, *p; unsigned int cpu = rq->cpu; struct list_head *queue; @@ -1904,9 +1903,12 @@ goto out; } - long_deadline = shortest_deadline = longest_deadline() + 1; list_for_each_entry(p, queue, run_list) { - unsigned long deadline_diff; + /* Deadline can be in the past, use signed longs */ + long long_deadline = longest_deadline() + 1; + long shortest_deadline = long_deadline; + long deadline_diff; + /* Make sure cpu affinity is ok */ if (!cpu_isset(cpu, p->cpus_allowed)) continue;