bfs 400 -> 401
[kernel-bfs] / kernel-bfs-2.6.28 / debian / patches / bfs-400-to-401.patch
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.
5
6 timeslice() can be an int.
7 Patch by _sid_
8
9 try_preempt need not check for rq_prio == highest_prio as it will always be by
10 that point in the code.
11 Patch by _sid_.
12
13 -ck
14
15 ---
16  include/linux/sched.h |    2 +-
17  kernel/sched_bfs.c    |    8 ++++----
18  2 files changed, 5 insertions(+), 5 deletions(-)
19
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
26   * time_slice.
27   */
28 -static inline unsigned long timeslice(void)
29 +static inline int timeslice(void)
30  {
31         return MS_TO_US(rr_interval);
32  }
33 @@ -1385,8 +1385,8 @@ static void try_preempt(struct task_stru
34                 if (rq_prio < highest_prio)
35                         continue;
36  
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;
43                         highest_prio_rq = rq;
44 @@ -2775,7 +2775,7 @@ static inline void set_rq_task(struct rq
45  {
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;
52         if (p != rq->idle)
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
58  
59  static inline void print_scheduler_version(void)
60  {
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");
63  }
64  
65  static inline int iso_task(struct task_struct *p)