device_changed callback does unnecessary work

Bug #1387810 reported by Iain Lane
This bug affects 1 person
Affects Status Importance Assigned to Milestone
powerd (Ubuntu)
powerd (Ubuntu RTM)

Bug Description

up_device_changed_cb iterates over all devices every time it's called. It is passed the device so this is unnecessary work and will result in a lot of dbus traffic. You should just look at the device which you've been told has changed.

With we're getting upower 0.99 support. One of the new additions to the 1.0 API you get with this version is proper notify signals for properties on UpClient and UpDevice. powerd should be refactored to only listen to property changes in the properties it is interested in. This will result in more efficient code and a process that is only woken up when it needs to be, and it will be nicer as it will then be properly event driven.

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: powerd (not installed)
ProcVersionSignature: Ubuntu 3.16.0-23.31-generic 3.16.4
Uname: Linux 3.16.0-23-generic x86_64
ApportVersion: 2.14.7-0ubuntu8
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Oct 30 17:05:13 2014
InstallationDate: Installed on 2012-10-07 (752 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Beta amd64 (20121007)
SourcePackage: powerd
UpgradeStatus: Upgraded to utopic on 2013-05-07 (541 days ago)

Revision history for this message
Iain Lane (laney) wrote :
summary: - Improve device_changed callback
+ device_changed callback does unnecessary work
Revision history for this message
Oliver Grawert (ogra) wrote :

in image smoke testing for touch we have a test called "systemsettle" it checks the idle state of the system before and after a test run by iterating over the "top" values (it doesnt actually use top but reads directly from /proc) ten times ... if the average idle value for these ten runs is not above 97.5% the test is considered a failure.

on the krillin device the systemsettle test constantly fails (while it passes on mako). looking through the logs we found that upowerd, indicator-power, powerd and specifically dbus-daemon seem to always be the top consumers causing the failure of the test. for now we decided to give the test a little more wiggle room by lowering the threshold by 1% but i think it is very valuable to get the described behavior of this bug fixed in the RTM touch image which IMHO will likely make the dbus noise be lower overall.

Thus this bug should be on the critical fixes list (the so called "olli's list") for RTM.

Changed in powerd (Ubuntu RTM):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Iain Lane (laney) wrote :

Actually thinking about it the list of devices probably isn't *that* long, so maybe this doesn't add as much as it might.

The second paragraph is the real issue and is only fixable with upower 0.99, which I doubt we want to change in RTM at this point. :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.