diff -NurpP --minimal linux-2.6.11-rc2-vs1.9.4-rc4/include/linux/vserver/sched.h linux-2.6.11-rc2-vs1.9.4-rc4.4/include/linux/vserver/sched.h --- linux-2.6.11-rc2-vs1.9.4-rc4/include/linux/vserver/sched.h 2005-01-22 16:01:43 +0100 +++ linux-2.6.11-rc2-vs1.9.4-rc4.4/include/linux/vserver/sched.h 2005-02-01 16:12:29 +0100 @@ -15,7 +15,7 @@ void vx_update_load(struct vx_info *); struct task_struct; -int effective_vavavoom(struct task_struct *, int); +int vx_effective_vavavoom(struct vx_info *, int); int vx_tokens_recalc(struct vx_info *); diff -NurpP --minimal linux-2.6.11-rc2-vs1.9.4-rc4/include/linux/vserver/sched_def.h linux-2.6.11-rc2-vs1.9.4-rc4.4/include/linux/vserver/sched_def.h --- linux-2.6.11-rc2-vs1.9.4-rc4/include/linux/vserver/sched_def.h 2005-01-22 16:01:43 +0100 +++ linux-2.6.11-rc2-vs1.9.4-rc4.4/include/linux/vserver/sched_def.h 2005-02-01 16:22:28 +0100 @@ -28,6 +28,8 @@ struct _vx_sched { uint32_t jiffies; /* last time accounted */ int priority_bias; /* bias offset for priority */ + int vavavoom; /* last calculated vavavoom */ + cpumask_t cpus_allowed; /* cpu mask for context */ struct _vx_ticks cpu[NR_CPUS]; diff -NurpP --minimal linux-2.6.11-rc2-vs1.9.4-rc4/kernel/sched.c linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/sched.c --- linux-2.6.11-rc2-vs1.9.4-rc4/kernel/sched.c 2005-01-27 13:24:54 +0100 +++ linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/sched.c 2005-02-01 16:13:00 +0100 @@ -621,6 +621,7 @@ static inline void enqueue_task_head(str static int effective_prio(task_t *p) { int bonus, prio; + struct vx_info *vxi; if (rt_task(p)) return p->prio; @@ -628,8 +629,10 @@ static int effective_prio(task_t *p) bonus = CURRENT_BONUS(p) - MAX_BONUS / 2; prio = p->static_prio - bonus; - if (task_vx_flags(p, VXF_SCHED_PRIO, 0)) - prio += effective_vavavoom(p, MAX_USER_PRIO); + + if ((vxi = p->vx_info) && + vx_info_flags(vxi, VXF_SCHED_PRIO, 0)) + prio += vx_effective_vavavoom(vxi, MAX_USER_PRIO); if (prio < MAX_RT_PRIO) prio = MAX_RT_PRIO; @@ -2688,8 +2691,8 @@ asmlinkage void __sched schedule(void) struct list_head *queue; unsigned long long now; unsigned long run_time; -#ifdef CONFIG_VSERVER_HARDCPU struct vx_info *vxi; +#ifdef CONFIG_VSERVER_HARDCPU int maxidle = -HZ; #endif int cpu, idx; @@ -2845,8 +2848,8 @@ go_idle: queue = array->queue + idx; next = list_entry(queue->next, task_t, run_list); -#ifdef CONFIG_VSERVER_HARDCPU vxi = next->vx_info; +#ifdef CONFIG_VSERVER_HARDCPU if (vx_info_flags(vxi, VXF_SCHED_PAUSE|VXF_SCHED_HARD, 0)) { int ret = vx_tokens_recalc(vxi); @@ -2862,8 +2865,10 @@ go_idle: //printk("··· %8lu hold %p [%d]\n", jiffies, next, next->prio); goto pick_next; } - } + } else /* well, looks ugly but not as ugly as the ifdef-ed version */ #endif + if (vx_info_flags(vxi, VXF_SCHED_PRIO, 0)) + vx_tokens_recalc(vxi); if (!rt_task(next) && next->activated > 0) { unsigned long long delta = now - next->timestamp; diff -NurpP --minimal linux-2.6.11-rc2-vs1.9.4-rc4/kernel/vserver/sched.c linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/vserver/sched.c --- linux-2.6.11-rc2-vs1.9.4-rc4/kernel/vserver/sched.c 2005-01-23 19:41:58 +0100 +++ linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/vserver/sched.c 2005-02-01 16:25:18 +0100 @@ -12,7 +12,6 @@ #include #include -// #include #include #include #include @@ -103,9 +102,8 @@ int vx_tokens_recalc(struct vx_info *vxi * * Both properties are important to certain workloads. */ -int effective_vavavoom(task_t *p, int max_prio) +int vx_effective_vavavoom(struct vx_info *vxi, int max_prio) { - struct vx_info *vxi = p->vx_info; int vavavoom, max; /* lots of tokens = lots of vavavoom @@ -125,6 +123,7 @@ int effective_vavavoom(task_t *p, int ma /* vavavoom = ( MAX_USER_PRIO*VAVAVOOM_RATIO/100*tokens_left(p) - MAX_USER_PRIO*VAVAVOOM_RATIO/100/2); */ + vxi->sched.vavavoom = vavavoom; return vavavoom; } diff -NurpP --minimal linux-2.6.11-rc2-vs1.9.4-rc4/kernel/vserver/sched_init.h linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/vserver/sched_init.h --- linux-2.6.11-rc2-vs1.9.4-rc4/kernel/vserver/sched_init.h 2005-01-22 16:01:43 +0100 +++ linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/vserver/sched_init.h 2005-02-01 16:21:38 +0100 @@ -14,6 +14,7 @@ static inline void vx_info_init_sched(st atomic_set(&sched->tokens, HZ >> 2); sched->cpus_allowed = CPU_MASK_ALL; sched->priority_bias = 0; + sched->vavavoom = 0; for_each_cpu(i) { sched->cpu[i].user_ticks = 0; diff -NurpP --minimal linux-2.6.11-rc2-vs1.9.4-rc4/kernel/vserver/sched_proc.h linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/vserver/sched_proc.h --- linux-2.6.11-rc2-vs1.9.4-rc4/kernel/vserver/sched_proc.h 2005-01-22 16:01:43 +0100 +++ linux-2.6.11-rc2-vs1.9.4-rc4.4/kernel/vserver/sched_proc.h 2005-02-01 16:21:14 +0100 @@ -14,12 +14,14 @@ static inline int vx_info_proc_sched(str "TokensMin:\t%8d\n" "TokensMax:\t%8d\n" "PrioBias:\t%8d\n" + "VaVaVoom:\t%8d\n" ,atomic_read(&sched->tokens) ,sched->fill_rate ,sched->interval ,sched->tokens_min ,sched->tokens_max ,sched->priority_bias + ,sched->vavavoom ); for_each_online_cpu(i) {