Linux gurus: Script to adjust ondemand govenor?

Soldato
Joined
10 Apr 2004
Posts
13,496
Right basically I have a NAS (UnRAID) which runs on slack ware.

When I'm accessing it the process shfs uses pretty much one core up (so 50%).

Now with the on demand governor the CPU speed jumps between the 4 states (800, 1800, 2300, 3000 mhz) and limits performance compared to when it's set at 3000mhz constantly.

I was wondering if it would be possible to write a script which would do the following:

Allow the on demand governor to be set back to defaults (i.e. up_threshold = 80% and sampling_down_factor=1 instead of 30/5) to maximise power savings.

And then when the shfs or afpd get above 10% usage it forces it to 3000mhz, with a timer of say 5 seconds.

So that would mean if shfs drops to below 10%, it remains at 3000mhz for 5 seconds longer, incase it's just a momentary drop in shfs %age.

This would result in me getting my maximum write performance (<40MB/sec to 60+MB/sec) and maximise power savings.

Possible OcUK gurus!?

I was thinking along the lines of:


if( shfs/afpd process > 10% CPU usage){
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
}

else{
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
}

+ some sort of max speed timer!

Possible?
 
Last edited:
Back
Top Bottom