Description of problem: tuned loops in select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) Version-Release number of selected component (if applicable): tuned-2.2.1-1.fc18.noarch How reproducible: always Steps to Reproduce: Just start tuned service, eg. boot computer Actual results: powertop: 47.4 mW 2,1 ms/s 19,8 Process /usr/bin/python -Es /usr/sbin/tuned -l -P Expected results: tuned shouldn't wake up CPU each second. Additional info: strace: Process 852 attached select(0, NULL, NULL, NULL, {0, 48834}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) Process 852 attached select(0, NULL, NULL, NULL, {0, 1512}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) /var/log/tuned/tuned.log 2013-03-04 12:17:44,845 INFO tuned.daemon.controller: terminating controller 2013-03-04 12:18:14,680 INFO tuned.profiles.loader: loading profile: powersave 2013-03-04 12:18:14,686 INFO tuned.daemon.controller: starting controller 2013-03-04 12:18:14,687 INFO tuned.daemon.daemon: starting tuning 2013-03-04 12:18:14,689 WARNING tuned.plugins.base: Unknown option 'hda_intel_powersave' for plugin 'AudioPlugin'. 2013-03-04 12:18:14,690 WARNING tuned.plugins.base: Unknown option 'ac97_powersave' for plugin 'AudioPlugin'. 2013-03-04 12:18:14,690 INFO tuned.plugins.base: instance audio: assigning devices snd_hda_intel 2013-03-04 12:18:14,693 INFO tuned.units.manager: skipping plugin 'eeepc_she', not supported on your system 2013-03-04 12:18:14,696 INFO tuned.plugins.base: instance video: assigning devices card0 2013-03-04 12:18:14,699 INFO tuned.plugins.plugin_net: devices: set([u'em1', u'wlan0']) 2013-03-04 12:18:14,700 INFO tuned.plugins.base: instance net: assigning devices em1, wlan0 2013-03-04 12:18:14,931 INFO tuned.plugins.base: instance disk: assigning devices sda, sdb 2013-03-04 12:18:14,935 INFO tuned.plugins.base: instance cpu: assigning devices cpu2, cpu3, cpu0, cpu1 2013-03-04 12:18:15,053 INFO tuned.plugins.plugin_script: calling script '/usr/lib/tuned/powersave/script.sh' with argument 'start' 2013-03-04 12:18:15,093 ERROR tuned.utils.commands: Reading /sys/class/drm/card0/device/power_profile error: [Errno 2] No such file or directory: u'/sys/class/drm/card0/device/power_profile' 2013-03-04 12:18:15,093 WARNING tuned.plugins.plugin_video: radeon_powersave is not supported on 'card
(In reply to comment #0) > Description of problem: > tuned loops in select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout) > Thanks for catching it. I got the source of the problem. It is in the underlying threading lib: # Balancing act: We can't afford a pure busy loop, so we # have to sleep; but if we sleep the whole timeout time, # we'll be unresponsive. The scheme here sleeps very # little at first, longer as time goes on, but never longer # than 20 times per second (or the timeout time remaining). ... endtime = _time() + timeout delay = 0.0005 # 500 us -> initial delay of 1 ms ... remaining = endtime - _time() ... delay = min(delay * 2, remaining, .05) _sleep(delay) So even if we call it with timeout = 10 seconds, it will never sleep longer than 50 milliseconds. That's really bad, we will probably need to redesign / drop the threading.
This python threading behaviour doesn't seems to be documented and it is bad for power consumption. Filled bug 917709 and added it to power management bugs tracker.
Wow! What a surprise. I guess the reason for this ugliness is the Global Interpreter Lock (GIL) in Python. There is an alternative module we could probably use instead. But supplies threads with subprocesses: http://docs.python.org/2/library/multiprocessing.html
Python3 is not affected by this issue. In a long-term we are going to port the tuned code to python3, but it will take some time, there are some python2 only deps like configobj. Annother way is to switch to alternative module. In Fedora the python2 will get downstream patch (bug 917709 comment 3) not to exhibit this behaviour. There are experimental packages ready with this patch for the F19 Power Management Test Day: http://fedorapeople.org/~jskarvad/pm-test-day-repo/
Moving to f20.
tuned-2.3.0-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/tuned-2.3.0-1.fc20
Package tuned-2.3.0-1.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing tuned-2.3.0-1.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-20857/tuned-2.3.0-1.fc20 then log in and leave karma (feedback).
tuned-2.3.0-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.