1 last_ran isn't being set reliably and on tasks that run for under one timer
2 tick, they may be seen as using up their timeslice the next time they're
3 scheduled. The lower the Hz, the more relevant this change will be.
4 Bug reported by Serge Belyshev.
6 timeslice() can be an int.
9 try_preempt need not check for rq_prio == highest_prio as it will always be by
10 that point in the code.
16 include/linux/sched.h | 2 +-
17 kernel/sched_bfs.c | 8 ++++----
18 2 files changed, 5 insertions(+), 5 deletions(-)
20 Index: linux-2.6.28/kernel/sched_bfs.c
21 ===================================================================
22 --- linux-2.6.28.orig/kernel/sched_bfs.c
23 +++ linux-2.6.28/kernel/sched_bfs.c
24 @@ -162,7 +162,7 @@ static int prio_ratios[PRIO_RANGE] __rea
25 * The quota handed out to tasks of all priority levels when refilling their
28 -static inline unsigned long timeslice(void)
29 +static inline int timeslice(void)
31 return MS_TO_US(rr_interval);
33 @@ -1385,8 +1385,8 @@ static void try_preempt(struct task_stru
34 if (rq_prio < highest_prio)
37 - if (rq_prio > highest_prio || (rq_prio == highest_prio &&
38 - deadline_after(rq->rq_deadline, latest_deadline))) {
39 + if (rq_prio > highest_prio ||
40 + deadline_after(rq->rq_deadline, latest_deadline)) {
41 latest_deadline = rq->rq_deadline;
42 highest_prio = rq_prio;
44 @@ -2775,7 +2775,7 @@ static inline void set_rq_task(struct rq
46 rq->rq_time_slice = p->time_slice;
47 rq->rq_deadline = p->deadline;
48 - rq->rq_last_ran = p->last_ran;
49 + rq->rq_last_ran = p->last_ran = rq->clock;
50 rq->rq_policy = p->policy;
51 rq->rq_prio = p->prio;
53 Index: linux-2.6.28/include/linux/sched.h
54 ===================================================================
55 --- linux-2.6.28.orig/include/linux/sched.h
56 +++ linux-2.6.28/include/linux/sched.h
57 @@ -1430,7 +1430,7 @@ static inline void tsk_cpus_current(stru
59 static inline void print_scheduler_version(void)
61 - printk(KERN_INFO"BFS CPU scheduler v0.400 by Con Kolivas.\n");
62 + printk(KERN_INFO"BFS CPU scheduler v0.401 by Con Kolivas.\n");
65 static inline int iso_task(struct task_struct *p)