Description of problem:
On my ThinkPad T60, hdapsd always uses 2% of cpu time.
Pasting 'top' output. Note the 'TIME' column usage for hdapsd.
top - 15:08:35 up 2:49, 3 users, load average: 2.21, 1.63, 0.96
Tasks: 205 total, 2 running, 203 sleeping, 0 stopped, 0 zombie
Cpu(s): 17.0%us, 3.4%sy, 0.0%ni, 74.7%id, 4.9%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3090240k total, 2736540k used, 353700k free, 736k buffers
Swap: 4095996k total, 0k used, 4095996k free, 1844988k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3389 root 20 0 672m 225m 11m R 35.7 7.5 2:42.46 yum
929 root 20 0 6328 556 468 S 2.3 0.0 3:58.32 hdapsd
4475 amit 20 0 15176 1296 912 R 1.0 0.0 0:01.93 top
Some CPU usage is expected - hdapsd wakes up 50 times per second to check the values of accelerometer.
Do you have latest hdaps.ko module from tp_smapi 0.40 installed? It is not shipped in Fedora or mainstream kernel, but can improve situation. See http://www.thinkwiki.org/wiki/Tp_smapi
Please check with "powertop" how many wakeups hdapsd generates.
I've not tried out the tp_smapi modules.
Powertop shows hdapsd wakes up the most on the system (not surprising):
PowerTOP version 1.13 (C) 2007 Intel Corporation
Cn Avg residency P-states (frequencies)
C0 (cpu running) ( 1.6%) 2.00 Ghz 42.8%
C0 0.0ms ( 0.0%) 1.67 Ghz 0.3%
C1 mwait 0.0ms ( 0.0%) 1333 Mhz 0.3%
C2 mwait 0.2ms ( 0.1%) 1000 Mhz 56.5%
C3 mwait 6.9ms (98.3%)
Wakeups-from-idle per second : 147.9 interval: 15.0s
no ACPI power usage estimate available
Top causes for wakeups:
25.0% ( 48.7) hdapsd
FYI, I forwared the question to upstream developers, it is currently sitting in moderator approval queue. In the meantime, could you provide few seconds snippet from "strace -o logfile.hdapsd.txt -v -f -p <pid of hdapsd>"?
(In reply to comment #3)
> FYI, I forwared the question to upstream developers, it is currently sitting in
> moderator approval queue.
Thanks. In the meantime, I tried playing around with the -s parameter. The default of 15 doesn't introduce these wakeups but a value of 22 does.
> In the meantime, could you provide few seconds
> snippet from "strace -o logfile.hdapsd.txt -v -f -p <pid of hdapsd>"?
I'll get this in a bit.
Created attachment 477064 [details]
Attached is the strace output; the config is:
$ cat /etc/sysconfig/hdapsd
# default sensivity is 15; bump it a little and enable adaptive tuning
HDAPSD_OPTIONS="-s 15 -a"
strace shows that hdaps on your system uses /sys interface for reading position. This is old interface and it's expected to consume more CPU.
Optimally, hdapsd should use /dev/input/event* which allows more efficient work. You probably need to install external hdapsd module. Get http://sourceforge.net/projects/tpctl/files/tp_smapi/0.40/ , unpack it and make "make HDAPS=1 install". Afterwards your hdapsd should work with less CPU.
FYI: this external tp_smapi won't be included in Fedora, because it is not in upstream kernel. And upstream kernel won't include tp_smapi because code ownership issues aren't clear.