Index: MM-2.6.X/kernel/sched.c =================================================================== --- MM-2.6.X.orig/kernel/sched.c 2006-02-21 16:27:32.000000000 +1100 +++ MM-2.6.X/kernel/sched.c 2006-02-21 17:01:12.000000000 +1100 @@ -169,13 +169,13 @@ #define SCALE_PRIO(x, prio) \ max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO/2), MIN_TIMESLICE) +#define PRIO_TO_TS(sp) \ + ((sp) < NICE_TO_PRIO(0) ? SCALE_PRIO(DEF_TIMESLICE*4, (sp)) : \ + SCALE_PRIO(DEF_TIMESLICE, (sp))) static unsigned int task_timeslice(task_t *p) { - if (p->static_prio < NICE_TO_PRIO(0)) - return SCALE_PRIO(DEF_TIMESLICE*4, p->static_prio); - else - return SCALE_PRIO(DEF_TIMESLICE, p->static_prio); + return PRIO_TO_TS(p->static_prio); } #define task_hot(p, now, sd) ((long long) ((now) - (p)->last_ran) \ < (long long) (sd)->cache_hot_time) @@ -680,11 +680,9 @@ static int effective_prio(task_t *p) */ /* - * Priority weight for load balancing ranges from 1/20 (nice==19) to 459/20 (RT - * priority of 100). + * Priority weight for load balancing ranges (based on time slice allocations). */ -#define NICE_TO_LOAD_PRIO(nice) \ - ((nice >= 0) ? (20 - (nice)) : (20 + (nice) * (nice))) +#define NICE_TO_LOAD_PRIO(nice) PRIO_TO_TS(NICE_TO_PRIO(nice)) #define LOAD_WEIGHT(lp) \ (((lp) * SCHED_LOAD_SCALE) / NICE_TO_LOAD_PRIO(0)) #define NICE_TO_LOAD_WEIGHT(nice) LOAD_WEIGHT(NICE_TO_LOAD_PRIO(nice))