diff -Nru upower-0.99.4/debian/changelog upower-0.99.4/debian/changelog --- upower-0.99.4/debian/changelog 2016-09-19 16:55:05.000000000 +0300 +++ upower-0.99.4/debian/changelog 2019-01-28 13:24:35.000000000 +0300 @@ -1,3 +1,10 @@ +upower (0.99.4-4+deb9u1) stretch; urgency=medium + + * Non-maintainer upload. + * Add patch to fix excessive CPU usage when /proc/timer_stats doesn't exist. + + -- Vlad Orlov Mon, 28 Jan 2019 13:24:35 +0300 + upower (0.99.4-4) unstable; urgency=medium * Install typelib files into multiarch paths. diff -Nru upower-0.99.4/debian/patches/fix-cpu-usage-without-proc-timer-stats.patch upower-0.99.4/debian/patches/fix-cpu-usage-without-proc-timer-stats.patch --- upower-0.99.4/debian/patches/fix-cpu-usage-without-proc-timer-stats.patch 1970-01-01 03:00:00.000000000 +0300 +++ upower-0.99.4/debian/patches/fix-cpu-usage-without-proc-timer-stats.patch 2019-01-28 13:23:02.000000000 +0300 @@ -0,0 +1,42 @@ +From 798588a480eaae50368bed75fc78f8314523b2a3 Mon Sep 17 00:00:00 2001 +From: Richard Hughes +Date: Sun, 23 Apr 2017 20:22:02 +0100 +Subject: Do not spin in a loop when /proc/timer_stats cannot be written + +Only set up the polling once the write has succeeded. + +Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100626 +--- + src/up-wakeups.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +Index: upower-0.99.4/src/up-wakeups.c +=================================================================== +--- upower-0.99.4.orig/src/up-wakeups.c ++++ upower-0.99.4/src/up-wakeups.c +@@ -626,6 +626,13 @@ up_wakeups_timerstats_enable (UpWakeups + + g_debug ("enabling timer stats"); + ++ /* enable timer stats */ ++ file = fopen (UP_WAKEUPS_SOURCE_USERSPACE, "w"); ++ if (file == NULL) ++ return FALSE; ++ fprintf (file, "1\n"); ++ fclose (file); ++ + /* setup polls */ + wakeups->priv->poll_kernel_id = + g_timeout_add_seconds (UP_WAKEUPS_POLL_INTERVAL_KERNEL, +@@ -637,11 +644,6 @@ up_wakeups_timerstats_enable (UpWakeups + (GSourceFunc) up_wakeups_poll_userspace_cb, wakeups); + g_source_set_name_by_id (wakeups->priv->poll_userspace_id, "[upower] up_wakeups_poll_userspace_cb"); + +- file = fopen (UP_WAKEUPS_SOURCE_USERSPACE, "w"); +- if (file == NULL) +- return FALSE; +- fprintf (file, "1\n"); +- fclose (file); + wakeups->priv->polling_enabled = TRUE; + return TRUE; + } diff -Nru upower-0.99.4/debian/patches/series upower-0.99.4/debian/patches/series --- upower-0.99.4/debian/patches/series 2016-09-19 16:55:05.000000000 +0300 +++ upower-0.99.4/debian/patches/series 2019-01-28 13:22:57.000000000 +0300 @@ -3,3 +3,4 @@ lib-Add-proper-error-and-cancellable-handling-to-UpC.patch lib-Remove-hidden-singleton-instance.patch up-tool-Exit-early-when-connecting-to-upower-fails.patch +fix-cpu-usage-without-proc-timer-stats.patch