Unity8 wakes up the CPU continuously at around 5Hz on a phone
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| The Ubuntu Power Consumption Project |
Undecided
|
Unassigned | ||
| qtmir (Ubuntu) |
High
|
Unassigned | ||
| unity8 (Ubuntu) |
High
|
Unassigned |
Bug Description
top reports the unity8 process is consuming about 1% CPU even when the phone is idle (screen on):
11688 phablet 20 0 482184 101352 44872 S 1.0 5.4 0:37.10 unity8
This makes unity8 the top consumer of CPU. 1% on modern CPUs like you find in phones is actually a very large amount of work going on (~10 million clock ticks spent executing instructions per second on a 1GHz core).
$ system-image-cli -i
current build number: 272
device name: mako
channel: ubuntu-
last update: 2015-07-29 05:53:01
version version: 272
version ubuntu: 20150729
version device: 20150708
version custom: 20150729
Running eventstat shows this CPU time is being used in 5 events per second:
Event/s PID Task Init Function Callback
36.36 0 [swapper/0] hrtimer_
5.05 11688 unity8 hrtimer_
So it sounds like QtMir's frame dropper is the culprit.
Related branches
- Gerry Boland (community): Approve on 2015-09-09
- PS Jenkins bot (community): Needs Fixing (continuous-integration) on 2015-09-08
-
Diff: 15 lines (+6/-0)1 file modifiedsrc/modules/Unity/Application/mirsurface.cpp (+6/-0)
description: | updated |
tags: | added: power-management |
tags: | added: phone |
tags: |
added: phablet removed: phone |
Changed in qtmir: | |
status: | New → Confirmed |
Changed in qtmir (Ubuntu): | |
status: | New → Confirmed |
status: | Confirmed → In Progress |
Changed in qtmir: | |
status: | Confirmed → In Progress |
Changed in qtmir (Ubuntu): | |
importance: | Undecided → High |
Changed in qtmir: | |
importance: | Undecided → Medium |
Changed in qtmir (Ubuntu): | |
assignee: | nobody → Daniel van Vugt (vanvugt) |
Changed in qtmir: | |
assignee: | nobody → Daniel van Vugt (vanvugt) |
Daniel van Vugt (vanvugt) wrote : | #1 |
Changed in qtmir: | |
status: | In Progress → Triaged |
Changed in qtmir (Ubuntu): | |
status: | In Progress → Triaged |
Changed in qtmir: | |
assignee: | Daniel van Vugt (vanvugt) → nobody |
Changed in qtmir (Ubuntu): | |
assignee: | Daniel van Vugt (vanvugt) → nobody |
Launchpad Janitor (janitor) wrote : | #2 |
This bug was fixed in the package qtmir - 0.4.6+15.
---------------
qtmir (0.4.6+
[ Daniel d'Andrada ]
* MirSurfaceItem gets dirty when it's set to draw a different (or no)
surface (LP: #1492185)
* QtEventFeeder: log the pointer events it gets from Mir
[ Daniel van Vugt ]
* Stop waking up every 200ms if there's nothing to wake up for. It's
just wasting battery. (LP: #1479250)
-- Gerry Boland <email address hidden> Mon, 14 Sep 2015 13:11:56 +0000
Changed in qtmir (Ubuntu): | |
status: | Triaged → Fix Released |
Changed in qtmir (Ubuntu): | |
status: | Fix Released → Triaged |
Daniel van Vugt (vanvugt) wrote : | #3 |
Even with the fix unity8 is the busiest process while the phone is idle. strace shows it is constantly:
clock_gettime(
clock_gettime(
poll([{fd=5, events=POLLIN}, {fd=49, events=POLLIN}, {fd=50, events=POLLIN}, {fd=54, events=POLLIN}, {fd=61, events=POLLIN}, {fd=71, events=POLLIN}, {fd=74, events=POLLIN}, {fd=78, events=POLLIN}, {fd=94, events=POLLIN}, {fd=102, events=POLLIN}, {fd=112, events=POLLIN}], 11, 2480) = 1 ([{fd=5, revents=POLLIN}])
read(5, "\1\0\0\0\0\0\0\0", 16) = 8
clock_gettime(
clock_gettime(
poll([{fd=5, events=POLLIN}, {fd=49, events=POLLIN}, {fd=50, events=POLLIN}, {fd=54, events=POLLIN}, {fd=61, events=POLLIN}, {fd=71, events=POLLIN}, {fd=74, events=POLLIN}, {fd=78, events=POLLIN}, {fd=94, events=POLLIN}, {fd=102, events=POLLIN}, {fd=112, events=POLLIN}], 11, 2412) = 1 ([{fd=5, revents=POLLIN}])
read(5, "\1\0\0\0\0\0\0\0", 16) = 8
clock_gettime(
clock_gettime(
poll([{fd=5, events=POLLIN}, {fd=49, events=POLLIN}, {fd=50, events=POLLIN}, {fd=54, events=POLLIN}, {fd=61, events=POLLIN}, {fd=71, events=POLLIN}, {fd=74, events=POLLIN}, {fd=78, events=POLLIN}, {fd=94, events=POLLIN}, {fd=102, events=POLLIN}, {fd=112, events=POLLIN}], 11, 2344) = 1 ([{fd=5, revents=POLLIN}])
read(5, "\1\0\0\0\0\0\0\0", 16) = 8
clock_gettime(
clock_gettime(
poll([{fd=5, events=POLLIN}, {fd=49, events=POLLIN}, {fd=50, events=POLLIN}, {fd=54, events=POLLIN}, {fd=61, events=POLLIN}, {fd=71, events=POLLIN}, {fd=74, events=POLLIN}, {fd=78, events=POLLIN}, {fd=94, events=POLLIN}, {fd=102, events=POLLIN}, {fd=112, events=POLLIN}], 11, 2279) = 1 ([{fd=5, revents=POLLIN}])
tags: | added: performance |
Daniel van Vugt (vanvugt) wrote : | #4 |
Still a problem, now on Unity8 in zesty desktop. An idle desktop spins the CPU constantly:
$ sudo strace -p `pidof unity8`
...
futex(0x55a7fef
futex(0x55a7fef
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 5) = 1 ([{fd=4, revents=POLLIN}])
read(4, "\6\0\0\0\0\0\0\0", 16) = 8
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 4) = 1 ([{fd=4, revents=POLLIN}])
read(4, "\6\0\0\0\0\0\0\0", 16) = 8
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 1) = 0 (Timeout)
futex(0x55a7fef
futex(0x55a7fef
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 5) = 0 (Timeout)
futex(0x55a7fef
futex(0x55a7fef
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 5) = 0 (Timeout)
futex(0x55a7fef
futex(0x55a7fef
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 5) = 1 ([{fd=4, revents=POLLIN}])
read(4, "\6\0\0\0\0\0\0\0", 16) = 8
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 2) = 0 (Timeout)
futex(0x55a7fef
futex(0x55a7fef
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd=82, events=POLLIN}, {fd=84, events=POLLIN}, {fd=86, events=POLLIN}, {fd=88, events=POLLIN}], 10, 0) = 1 ([{fd=4, revents=POLLIN}])
read(4, "\6\0\0\0\0\0\0\0", 16) = 8
poll([{fd=4, events=POLLIN}, {fd=42, events=POLLIN}, {fd=44, events=POLLIN}, {fd=60, events=POLLIN}, {fd=68, events=POLLIN}, {fd=80, events=POLLIN}, {fd...
summary: |
- unity8 process using CPU when the phone is idle + Unity8 wakes up the CPU continuously even when idle |
Changed in unity8 (Ubuntu): | |
importance: | Undecided → Medium |
importance: | Medium → High |
tags: | added: unity8-desktop |
Looks like a common theme all along is:
read(fd, buf, 16) = 8
So what polls for and reads into a max buffer size of 16?
Daniel van Vugt (vanvugt) wrote : | #6 |
eventstat reports the wakeup frequency is suspiciously familiar:
Event/s PID Task Init Function Callback
62.00 12359 QSGRenderThread do_nanosleep hrtimer_wakeup
62.00 11858 unity8 schedule_
Daniel van Vugt (vanvugt) wrote : | #7 |
I'm moving this new desktop issue into a new bug 1664828
summary: |
- Unity8 wakes up the CPU continuously even when idle + Unity8 wakes up the CPU continuously at around 5Hz on a phone |
no longer affects: | qtmir |
My attached branch only solves half the problem, so this bug needs to stay open till the other half is investigated.