The Spectre of Math

July 12, 2011

No more overheating

Filed under: Hacking,Linux,Technology — jlebl @ 7:15 pm

Pissed off about the CPU overheating, I wrote a simple daemon. It monitors the core temperatures and sets the cpufreq governor to powersave when temperature in either core is above 90 deg celsius, and sets it back to ondemand when it gets below 75 in both cores (those numbers I pulled out of my ass, they might need tuning). It simply polls the temperature every 5 seconds. There is no configuration or anything, simply change code and recompile. It’s all the neurons I’m willing to commit to this problem.

Yes I know performance might suffer since the CPU can go even further, but I don’t care about performance, I care about the machine not turning off randomly. I guess ondemand is actually better power (and heat) wise when everything is normal, but when then heat is high, powersave does come to the rescue.

Here is the code for those that want to do something similar. You might need to modify it heavily. I called it noverheatd.c, I simply compile the thing with something like gcc -O2 -Wall noverheatd.c -o noverheatd, placed the resulting binary in /root and then in /etc/rc.local I added /root/noverheatd &. The parts that need modification is set_policy where you need to set the number of CPUs your kernel thinks it has, and then in the main loop you need to set the right coretemp paths for all the coretemps you have. I had to run “sensors-detect” as root from the lm_sensors package to obtain those guys.

Update: Poll every 5 seconds rather than every two seconds.

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.