diff -u -U 2 -r -N -d linux-2.6.9.orig/drivers/cpufreq/cpufreq_ondemand.c linux-2.6.9/drivers/cpufreq/cpufreq_ondemand.c --- linux-2.6.9.orig/drivers/cpufreq/cpufreq_ondemand.c 2004-10-18 22:55:27.000000000 +0100 +++ linux-2.6.9/drivers/cpufreq/cpufreq_ondemand.c 2004-11-06 13:08:46.000000000 +0000 @@ -81,6 +81,7 @@ unsigned int sampling_down_factor; unsigned int up_threshold; unsigned int down_threshold; + unsigned int ignore_nice; }; struct dbs_tuners dbs_tuners_ins = { @@ -120,6 +121,7 @@ show_one(sampling_down_factor, sampling_down_factor); show_one(up_threshold, up_threshold); show_one(down_threshold, down_threshold); +show_one(ignore_nice, ignore_nice); static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, const char *buf, size_t count) @@ -189,6 +191,22 @@ return count; } +static ssize_t store_ignore_nice(struct cpufreq_policy *unused, + const char *buf, size_t count) +{ + unsigned int input; + int ret; + ret = sscanf (buf, "%u", &input); + down(&dbs_sem); + if ( ret == 1 ) { + if ( input > 1 ) + input = 1; + dbs_tuners_ins.ignore_nice = input; + } + up(&dbs_sem); + return count; +} + #define define_one_rw(_name) \ static struct freq_attr _name = { \ .attr = { .name = __stringify(_name), .mode = 0644 }, \ @@ -200,6 +218,7 @@ define_one_rw(sampling_down_factor); define_one_rw(up_threshold); define_one_rw(down_threshold); +define_one_rw(ignore_nice); static struct attribute * dbs_attributes[] = { &sampling_rate_max.attr, @@ -208,6 +227,7 @@ &sampling_down_factor.attr, &up_threshold.attr, &down_threshold.attr, + &ignore_nice.attr, NULL }; @@ -247,6 +267,10 @@ /* Check for frequency increase */ total_idle_ticks = kstat_cpu(cpu).cpustat.idle + kstat_cpu(cpu).cpustat.iowait; + /* consider 'nice' tasks as 'idle' time too if required */ + if (dbs_tuners_ins.ignore_nice == 0) + total_idle_ticks += kstat_cpu(cpu).cpustat.nice; + idle_ticks = total_idle_ticks - this_dbs_info->prev_cpu_idle_up; this_dbs_info->prev_cpu_idle_up = total_idle_ticks; @@ -346,10 +370,12 @@ this_dbs_info->prev_cpu_idle_up = kstat_cpu(cpu).cpustat.idle + - kstat_cpu(cpu).cpustat.iowait; + kstat_cpu(cpu).cpustat.iowait + + kstat_cpu(cpu).cpustat.nice; this_dbs_info->prev_cpu_idle_down = kstat_cpu(cpu).cpustat.idle + - kstat_cpu(cpu).cpustat.iowait; + kstat_cpu(cpu).cpustat.iowait + + kstat_cpu(cpu).cpustat.nice; this_dbs_info->enable = 1; sysfs_create_group(&policy->kobj, &dbs_attr_group); dbs_enable++; @@ -368,6 +394,7 @@ def_sampling_rate = (latency / 1000) * DEF_SAMPLING_RATE_LATENCY_MULTIPLIER; dbs_tuners_ins.sampling_rate = def_sampling_rate; + dbs_tuners_ins.ignore_nice = 0; dbs_timer_init(); }