# Frequency scaling

## ssteinberg

Hey,

I am using the 2.6.35-r5 kernel on a Core 2 Duo. Sometimes frequency scales under load, sometimes not. Can't really understand why, seems like a reboot is the only way to fix it. 

ondemand governor with 70% up-threshold, ignore nice load set to 0. Changing to performance does change frequency correctly. /sys/devices/system/cpu/cpufreq reports all correct and sane info, so does cpufreq-info.

Kernel config:

CONFIG_CPU_FREQ=y

CONFIG_CPU_FREQ_TABLE=y

# CONFIG_CPU_FREQ_DEBUG is not set

# CONFIG_CPU_FREQ_STAT is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set

CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y

# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set

CONFIG_CPU_FREQ_GOV_USERSPACE=y

CONFIG_CPU_FREQ_GOV_ONDEMAND=y

# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set

# CONFIG_X86_PCC_CPUFREQ is not set

CONFIG_X86_ACPI_CPUFREQ=y

Anyone encountered this kind of behavior?

----------

## Jimini

Have you set your desired governor in /etc/conf.d/cpufrequtils? Is the cpufrequtils-daemon running? If I remember correctly, I had the same problem - until I set up this daemon correctly.

Best regards,

Jimini

----------

## ssteinberg

The daemon just changes the governor based on configurable rules. Like temperature, battery level and AC power. Useful for laptops, not so much for desktops. I don't want a userspace governor.

cpufrequtils runs on start and sets to ondemand.

----------

## dmpogo

 *Jimini wrote:*   

> Have you set your desired governor in /etc/conf.d/cpufrequtils? Is the cpufrequtils-daemon running? If I remember correctly, I had the same problem - until I set up this daemon correctly.
> 
> Best regards,
> 
> Jimini

 

Why do you need a daemon to have frequency scalling ??  ondemand kernel governer does it by itself.

One thing to notice is that frequency scaling is done by core,  so when you look under the load what frequency you CPU is running, make sure you look at every core.  Also Core 2 Duo's change frequency pretty fast, so make sure you catch your reading indeed when a core is loaded.  For example, if you compile the kernel,

CPU is loaded in short bursts, and frequency may change up and down quite quickly.

----------

## Jimini

 *dmpogo wrote:*   

> Why do you need a daemon to have frequency scalling ??  ondemand kernel governer does it by itself.

 

On two of my machines I had the problem, that the governor was sometimes set to "userspace" instead of "ondemand", or that my desired governor was only set for two of four cpu cores. Since I have set up cpufrequtils as a daemon, everything works as I want it to be.

Best regards,

Jimini

----------

## ssteinberg

Stress testing with 100% load on each core. No scaling on any of the cores. ondemand is set per core. min-max range is sane and set per core as well.

----------

## dmpogo

 *ssteinberg wrote:*   

> Stress testing with 100% load on each core. No scaling on any of the cores. ondemand is set per core. min-max range is sane and set per core as well.

 

There are some discussions in the forums about not being able to change frequency with latest kernels.  However I was under impression that in discussed cases it is not intermittent as you have.  Interesting that you have it working sometimes, is it so ?

----------

## ssteinberg

userspace works fine, so does performance. ondemand doesn't. Kinda anoying. I suppose writing a daemon for on-demand userspace scaling wouldn't take me long, but that is just not it...

----------

## dmpogo

 *ssteinberg wrote:*   

> userspace works fine, so does performance. ondemand doesn't. Kinda anoying. I suppose writing a daemon for on-demand userspace scaling wouldn't take me long, but that is just not it...

 

I see, I undertstood that ondemand sometimes work, sometimes not.    If you change the frequency by hand by echoing the number into appropriate /sys file, does it work ?

----------

## ssteinberg

Yes. Like I said userspace works perfectly. I can set frequency to one of the 2 steps avaliable (6X and 8X multiplier). performance works too.

ondemand sometimes does, sometimes doesn't.

----------

