1

I have Debian installed on my Macbook Air (why? because fun.), and it actually runs quite well.

However, after noticing a process called "kidle_inject" taking up 100% CPU on all cores, I wanted to check the temperature, and "sensors" told me it was hovering at 96 degrees C. Fan was barely running.

I notice that on OSX, it'll be running as soon as I turn on the system (was perhaps still warm from a moment ago), while I barely hear it on Debian, and the laptop also seems to be hotter to the touch when on Debian.

Is there a way I can tell Debian to use the fan more aggressively?

3
  • kidle_inject doesn't actually use CPU time. “Idle” in the name means that the CPU is idle. It's a placeholder that the kernel uses when it isn't executing anything. See e.g. askubuntu.com/questions/482307/… Oct 2, 2016 at 19:53
  • Hi. Yes, I understand what kidle_inject does, but I believe they're being used to keep the CPU from oveheating in my case. (flood the cpu with idle injections such that it doesn't do any work). All the other programs are slow, sensors returns that my CPU is at 96 degrees C, but the fan is barely running. OSX simply runs the fan much more. Oct 3, 2016 at 7:46
  • allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon seems to be helpful. Oct 20, 2016 at 18:26

1 Answer 1

0

http://allanmcrae.com/2010/05/simple-macbook-pro-fan-daemon/ turned out to be a useful start.

In /sys/devices/platform/applesmc.768/, there are a few useful options that can be used to control fan speed.

There is "fan1_min" and "fan1_max" which are the minimum and maximum fan speeds, "fan1_output" which is the setting that directly controls the fan, and "fan1_manual" which makes the system ignore the minimum and maximum settings and directly respond to changes to "fan1_output".

How to control these automatically is the next point on the agenda.

EDIT: Also, be careful with these settings, as it is very well possible to simply turn off the fan, exposing your system to the dangers of overheating.

Second edit:

It also appears the information on that page is a little outdated, as I found the temperature sensor readings to be in the same directory as the fan settings, rather than in that other directory suggested by the page.

Third edit: based on the algorithms on that page, I wrote a quick python script that, when run as root, seems to work quite well:

#!/usr/bin/python
import time
import glob
import math

last_temp = 0

while True:

    time.sleep(1)

    files = glob.glob("/sys/devices/platform/applesmc.768/temp*_input")

    temp = 0

    for file in files:
        with open(file) as openfile:
            sensor_temp = openfile.read()

            temp = max(int(sensor_temp)/1000, temp)

    with open("/sys/devices/platform/applesmc.768/fan1_input") as fan1_input:
        current_speed = int(fan1_input.read())

    increasing = temp > last_temp

    last_temp = temp

    if increasing:
        if temp <= 65:
            speed = max(current_speed, 2000)
        elif 65 < temp < 80:
            step = (6200 - 2000) / ((80 - 65) * (80 - 64) / 2)
            speed = max(current_speed, math.ceil(2000 + (temp - 65) * (temp - 64) / 2 * step))
        elif temp >= 80:
            speed = 6200
    else:
        if temp >= 80:
            speed = 6200
        elif 55 < temp < 80:
            step = (6200 - 2000) / ( (80 - 55) * (80 - 54) / 2 )
            speed = min(current_speed, math.floor(6200 - (80 - temp) * (81 - temp) / 2 * step))
        elif temp <= 55:
            speed = 2000

    print "Temperature: " + str(temp) + " Increasing?: " + str(increasing) + " Current speed: " + str(current_speed) + " Target: " + str(speed)

    with open("/sys/devices/platform/applesmc.768/fan1_min", "w") as fan1_input:
    #with open("/home/werner/testtemp", 'w+') as fan1_input:
        fan1_input.write(str(int(speed)))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .