Bug 160659 - hald polls /proc/apm excessively
hald polls /proc/apm excessively
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: hal (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: David Zeuthen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-16 10:02 EDT by Nick Lamb
Modified: 2013-03-05 22:43 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-06-16 10:23:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nick Lamb 2005-06-16 10:02:59 EDT
Description of problem:

Duron 700 desktop (ie not laptop) - upgraded from FC3, and before that previous
versions of FC/ Red Hat - unnecessarily polls APM, wasting 0.2% of CPU all day,
every day.

Version-Release number of selected component (if applicable): 0.5.2-2

hald wakes up every so often (2 seconds? a bit less?) and reads the /proc/apm
file _twice_ before going back to sleep. This is undesirable at best.

Here's a system call trace of the behaviour.

poll([{fd=5, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN},
{fd=7, events=POLLIN}, {fd=13, events=POLLIN}, {fd=9, events=POLLIN|POLLPRI},
{fd=8, events=POLLIN}], 7, 1514) = 0
gettimeofday({1118929418, 873249}, NULL) = 0
open("//proc/apm", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7f1c000
read(3, "1.16ac 1.2 0x03 0x01 0xff 0x80 -"..., 1024) = 40
close(3)                                = 0
munmap(0xb7f1c000, 4096)                = 0
open("//proc/apm", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7f1c000
read(3, "1.16ac 1.2 0x03 0x01 0xff 0x80 -"..., 1024) = 40
close(3)                                = 0
munmap(0xb7f1c000, 4096)                = 0
gettimeofday({1118929419, 31308}, NULL) = 0

At least I should like to see this code changed to read /proc/apm only once for
each repetition, but preferably I should like to be able to turn this off
altogether. There's nothing for HAL to see in this APM structure on a desktop
PC, just mindless repetition.
Comment 1 David Zeuthen 2005-06-16 10:23:15 EDT
> There's nothing for HAL to see in this APM structure on a desktop
> PC, just mindless repetition.

If you're using APM, there's unfortunately no reliable way (we can't trust the
DMI tables, sorry) to detect whether there is a battery or not so we have to do
this. Suggest to use ACPI instead and then this won't happen. 

I've noted upstream (I'm upstream) to only read /proc/apm once per poll and
perhaps poll less often (say every ten seconds instead of every two seconds) -
that will be in the next release.

Note You need to log in before you can comment on or make changes to this bug.