plugsched-5.2.2 to 5.2.3 Index: 2.6.12/kernel/sched_spa.c =================================================================== --- 2.6.12.orig/kernel/sched_spa.c 2005-07-22 09:09:17.000000000 -0500 +++ 2.6.12/kernel/sched_spa.c 2005-07-25 15:24:02.000000000 -0500 @@ -79,7 +79,7 @@ #define MIN_TIMESLICE 1 #define DEF_TIMESLICE (100 * HZ / 1000) #define MAX_TIMESLICE (1000 * HZ / 1000) -#define DEF_DESKTOP_TIMESLICE ((DEF_TIMESLICE > 10) ? (DEF_TIMESLICE / 10) : 1) +#define DEF_DESKTOP_TIMESLICE ((10 * HZ / 1000) ? (10 * HZ / 1000) : MIN_TIMESLICE) static unsigned long time_slice = DEF_TIMESLICE; static unsigned long sched_rr_time_slice = DEF_TIMESLICE; @@ -376,7 +376,13 @@ */ static inline void preempt_if_warranted(task_t *p, struct runqueue *rq) { - if (TASK_PREEMPTS_CURR(p, rq)) + if (TASK_PREEMPTS_CURR(p, rq)) { + resched_task(rq->curr); + return; + } + + if ((p->prio == rq->curr->prio) && (p->sdu.spa.cpustats.flags & CPUSTATS_WOKEN_FOR_INTR_FL) + && !(rq->curr->sdu.spa.cpustats.flags & CPUSTATS_WOKEN_FOR_INTR_FL)) resched_task(rq->curr); } @@ -433,7 +439,7 @@ */ static void spa_fork(task_t *p) { - unsigned long now; + unsigned long long now; init_timer(&p->sdu.spa.sinbin_timer); p->sdu.spa.sinbin_timer.data = (unsigned long) p; @@ -810,8 +816,8 @@ } } + update_cpu_clock(prev, rq, now); delta_cpu_cpustats(prev, now); - prev->sched_time = prev->sdu.spa.cpustats.total_cpu; if (task_needs_sinbinning(prev) && likely(!signal_pending(prev))) put_task_in_sinbin(prev, required_sinbin_durn(prev)); @@ -1360,6 +1366,7 @@ spa_reassess_at_end_of_ts = zaphod_reassess_at_end_of_ts; #endif init_task.sdu.spa.zaphod = zaphod_task_data_init(); + time_slice = DEF_DESKTOP_TIMESLICE; } #endif } Index: 2.6.12/kernel/sched_zaphod.c =================================================================== --- 2.6.12.orig/kernel/sched_zaphod.c 2005-07-22 09:09:17.000000000 -0500 +++ 2.6.12/kernel/sched_zaphod.c 2005-07-25 15:23:58.000000000 -0500 @@ -140,11 +140,12 @@ unsigned long cpu_hog_threshold = PROP_FM_PPT(DEFAULT_CPU_HOG_THRESHOLD); /* - * Tasks that would sleep for more than 900 parts per thousand of the time if - * they had the CPU to themselves are considered to be interactive provided - * that their average sleep duration per scheduling cycle isn't too long + * Tasks that would sleep for more than this many parts per thousand of the + * time if they had the CPU to themselves are considered to be interactive + * provided that their average sleep duration per scheduling cycle isn't too + * long */ -#define DEFAULT_IA_THRESHOLD 900 +#define DEFAULT_IA_THRESHOLD 500 unsigned long ia_threshold = PROP_FM_PPT(DEFAULT_IA_THRESHOLD); #define LOWER_MAX_IA_SLEEP SCHED_AVG_REAL(15 * 60LL * NSEC_PER_SEC) #define UPPER_MAX_IA_SLEEP SCHED_AVG_REAL(2 * 60 * 60LL * NSEC_PER_SEC) @@ -415,12 +416,18 @@ void zaphod_reassess_at_end_of_ts(struct task_struct *p) { recalc_throughput_bonus(p); - reassess_cpu_boundness(p); + /* if a whole time slice gets used during the first or second + * CPU burst then the initial interactive bonus is forfeit and the + * task starts again from scratch trying to establish its interactive + * bona fides + */ + if (TASK_CPUSTATS(p).total_wake_ups < 2) + TASK_ZD(p).interactive_bonus = 0; + else + reassess_cpu_boundness(p); /* - * Arguably the interactive bonus should be updated here - * as well. But depends on whether we wish to encourage - * interactive tasks to maintain a high bonus or CPU bound - * tasks to lose some of there bonus? + * Interactive bonus is not updated here as long CPU bursts (greater + * than a time slice) are atypical of interactive tasks */ calculate_pre_bonus_priority(p); } @@ -443,8 +450,8 @@ SCHED_DRV_SYSFS_UINT_RW(max_ia_bonus, no_change, no_change, 0, max_max_ia_bonus); SCHED_DRV_SYSFS_UINT_RW(initial_ia_bonus, no_change, no_change, 0, max_max_ia_bonus); SCHED_DRV_SYSFS_UINT_RW(max_tpt_bonus, no_change, no_change, 0, max_max_tpt_bonus); -SCHED_DRV_SYSFS_UINT_RW(ia_threshold, ppt_to_proportion, proportion_to_ppt, 0, 1000); -SCHED_DRV_SYSFS_UINT_RW(cpu_hog_threshold, ppt_to_proportion, proportion_to_ppt, 0, 1000); +SCHED_DRV_SYSFS_UINT_RW(ia_threshold, ppt_to_proportion, proportion_to_ppt, 0, PROPORTION_ONE); +SCHED_DRV_SYSFS_UINT_RW(cpu_hog_threshold, ppt_to_proportion, proportion_to_ppt, 0, PROPORTION_ONE); static ssize_t show_zaphod_mode(char *page) {