I just dist-upgraded again, and with 4.8.0-14 my brightness keys work
again (bug 1626429). Under i3 (no unity-settings-daemon), I get a tame
and immediate reaction:

UDEV  [38372.886325] change   
/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0 (backlight)
ACTION=change
DEVPATH=/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
ID_PATH=pci-0000:00:02.0
ID_PATH_TAG=pci-0000_00_02_0
SEQNUM=2735
SOURCE=hotkey
SUBSYSTEM=backlight
SYSTEMD_WANTS=systemd-backlight@backlight:acpi_video0.service
TAGS=:systemd:
USEC_INITIALIZED=9377712


21:07:21 fork   1298 parent          /lib/systemd/systemd-udevd
21:07:21 fork  25614 child           /lib/systemd/systemd-udevd
21:07:21 exit  25614      0    0.002 /lib/systemd/systemd-udevd

which matches the one uevent, but there is no userspace helper involved.
Brightness change still works as it's hardwired into the driver. This
proves that with just kernel and udev rules there is no delay and waste.

Under unity, with unity-settings-daemon, I now confirm the flurry of
userspace action. The main pain point is the pkexec in

  pkexec /usr/lib/unity-settings-daemon/usd-backlight-helper --get-
brightness

as that starts a full new PAM session, including systemd --user and
other expensive stuff. Our /etc/pam.d/polkit-1 pulls in "common-
session"; when changing this to "common-session-noninteractive" it
becomes muuuch cheaper, but this would again be wrong for cases where we
actually do want to run a new session for whatever we run there -- I'm
trying to think about cases where this would break. I. e. should pk-exec
behave more like "su" or "su -".

It would probably be best to grep the archive for usage of pk-exec,
review whether any of it requires an interactive PAM session, and if not
switch it to noninteractive.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1626651

Title:
  brightness keys are handled slower in Yakkety than Xenial

Status in policykit-1 package in Ubuntu:
  Triaged
Status in unity-settings-daemon package in Ubuntu:
  Triaged

Bug description:
  I've noticed on Lenovo X220 and X230 laptops that pressing brightness
  keys on Yakkety seems less responsive and slower than Xenial.  I ran
  forkstat on Xenial and just observed udev being forked off:

  Xenial:
  $ sudo forkstat
  Time     Event  PID  Info  Duration Process
  17:37:35 fork    273 parent          /lib/systemd/systemd-udevd
  17:37:35 fork   1977 child           /lib/systemd/systemd-udevd
  17:37:35 exit   1977      0    0.008 /lib/systemd/systemd-udevd

  Whereas on Yakkety, there is far more activity:
  Time     Event  PID  Info  Duration Process
  16:35:34 fork   2626 parent          update-notifier
  16:35:34 fork   2645 child           update-notifier
  16:35:34 exec   2645                 /usr/bin/python3 
/usr/share/apport/apport-checkreports
  16:35:34 exit   2645    256    0.221 /usr/bin/python3 
/usr/share/apport/apport-checkreports
  16:35:34 fork   2626 parent          update-notifier
  16:35:34 fork   2646 child           update-notifier
  16:35:34 exec   2646                 /usr/bin/python3 
/usr/share/apport/apport-checkreports --system
  16:35:34 exit   2646    256    0.188 /usr/bin/python3 
/usr/share/apport/apport-checkreports --system
  16:35:36 fork   1576 parent          
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 fork   2647 child           
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 exec   2647                 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-max-brightness
  16:35:36 exit   2647      0    0.008 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-max-brightness
  16:35:36 fork   1576 parent          
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 fork   2648 child           
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 exec   2648                 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-brightness
  16:35:36 exit   2648      0    0.006 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-brightness
  16:35:36 fork   1576 parent          
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 fork   2649 child           
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 exec   2649                 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-brightness
  16:35:36 exit   2649      0    0.007 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-brightness
  16:35:36 fork   1576 parent          
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 fork   2650 child           
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 exec   2650                 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-max-brightness
  16:35:36 exit   2650      0    0.006 
/usr/lib/unity-settings-daemon/usd-backlight-helper --get-max-brightness
  16:35:36 fork   1576 parent          
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 fork   2651 child           
/usr/lib/unity-settings-daemon/unity-settings-daemon
  16:35:36 exec   2651                 pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 clone  2651 parent          pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 clone  2652 thread          pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 clone  2651 parent          pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 clone  2653 thread          pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 fork      1 parent          /sbin/init splash
  16:35:36 fork   2654 child           /sbin/init splash
  Time     Event  PID  Info  Duration Process
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2655 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2656 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2657 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2658 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2659 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2659      0    0.005 /lib/systemd/systemd-udevd
  16:35:36 exit   2658      0    0.006 /lib/systemd/systemd-udevd
  16:35:36 exit   2657      0    0.007 /lib/systemd/systemd-udevd
  16:35:36 exit   2656      0    0.008 /lib/systemd/systemd-udevd
  16:35:36 exit   2655      0    0.008 /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2660 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2660      0    0.001 /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2661 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2661      0    0.002 /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2662 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2663 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2664 child           /lib/systemd/systemd-udevd
  16:35:36 fork   2654 parent          /sbin/init splash
  16:35:36 fork   2665 child           (systemd)
  16:35:36 exec   2654                 /lib/systemd/systemd --user
  16:35:36 exit   2662      0    0.010 /lib/systemd/systemd-udevd
  16:35:36 exit   2664      0    0.007 /lib/systemd/systemd-udevd
  Time     Event  PID  Info  Duration Process
  16:35:36 exit   2663      0    0.009 /lib/systemd/systemd-udevd
  16:35:36 fork   2654 parent          /lib/systemd/systemd --user
  16:35:36 fork   2666 child           /lib/systemd/systemd --user
  16:35:36 exit   2666      0    0.001 /lib/systemd/systemd --user
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2667 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2667      0    0.003 /lib/systemd/systemd-udevd
  16:35:36 fork   2654 parent          /lib/systemd/systemd --user
  16:35:36 fork   2668 child           /lib/systemd/systemd --user
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2669 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2669      0    0.002 /lib/systemd/systemd-udevd
  16:35:36 exec   2668                 /bin/systemctl --user set-environment 
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2670 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2670      0    0.001 /lib/systemd/systemd-udevd
  16:35:36 exit   2668      0    0.009 /bin/systemctl --user set-environment 
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
  16:35:36 fork      2 parent          [kthreadd]
  16:35:36 fork   2671 child           [kworker/u16:4]
  16:35:36 exec   2671                 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service/dbus.socket]
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2672 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2673 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2674 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2675 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2676 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2671      0    0.005 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service/dbus.socket]
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  Time     Event  PID  Info  Duration Process
  16:35:36 fork   2677 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2678 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2653      0    0.126 pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 exit   2652      0    0.126 pkexec 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 exec   2651                 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 exit   2673      0    0.013 /lib/systemd/systemd-udevd
  16:35:36 exit   2672      0    0.013 /lib/systemd/systemd-udevd
  16:35:36 exit   2678      0    0.011 /lib/systemd/systemd-udevd
  16:35:36 exit   2675      0    0.013 /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2679 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2674      0    0.020 /lib/systemd/systemd-udevd
  16:35:36 exit   2651      0    0.146 
/usr/lib/unity-settings-daemon/usd-backlight-helper --set-brightness 2250
  16:35:36 fork      2 parent          [kthreadd]
  16:35:36 fork   2680 child           [kworker/u16:5]
  16:35:36 exec   2680                 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/session-2.scope]
  16:35:36 exit   2676      0    0.022 /lib/systemd/systemd-udevd
  16:35:36 exit   2679      0    0.003 /lib/systemd/systemd-udevd
  16:35:36 exit   2677      0    0.022 /lib/systemd/systemd-udevd
  16:35:36 exit   2680      0    0.003 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/session-2.scope]
  16:35:36 fork   2654 parent          /lib/systemd/systemd --user
  16:35:36 fork   2681 child           /lib/systemd/systemd --user
  16:35:36 exec   2681                 /bin/kill -s 58 2654
  16:35:36 exit   2681      0    0.200 /bin/kill -s 58 2654
  16:35:36 fork      2 parent          [kthreadd]
  16:35:36 fork   2682 child           [kworker/u16:5]
  16:35:36 exec   2682                 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service/systemd-exit.service]
  16:35:36 exit   2654      0    0.294 /lib/systemd/systemd --user
  16:35:36 exit   2682      0    0.004 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service/systemd-exit.service]
  16:35:36 exit   2665      9    0.272 (systemd)
  16:35:36 fork      2 parent          [kthreadd]
  Time     Event  PID  Info  Duration Process
  16:35:36 fork   2683 child           [kworker/u16:5]
  16:35:36 exec   2683                 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service/init.scope]
  16:35:36 fork      2 parent          [kthreadd]
  16:35:36 fork   2684 child           [kworker/u16:4]
  16:35:36 fork      2 parent          [kthreadd]
  16:35:36 fork   2685 child           [systemd-cgroups]
  16:35:36 exec   2684                 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service]
  16:35:36 exec   2685                 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice]
  16:35:36 exit   2683      0    0.005 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service/init.scope]
  16:35:36 exit   2685      0    0.005 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice]
  16:35:36 exit   2684      0    0.007 [/lib/systemd/systemd-cgroups-agent 
/user.slice/user-0.slice/user@0.service]
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2686 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2687 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2688 child           /lib/systemd/systemd-udevd
  16:35:36 fork    233 parent          /lib/systemd/systemd-udevd
  16:35:36 fork   2689 child           /lib/systemd/systemd-udevd
  16:35:36 exit   2687      0    0.014 /lib/systemd/systemd-udevd
  16:35:36 exit   2689      0    0.013 /lib/systemd/systemd-udevd
  16:35:36 exit   2686      0    0.015 /lib/systemd/systemd-udevd
  16:35:36 exit   2688      0    0.015 /lib/systemd/systemd-udevd

  I suspect some of this overhead explains the slower responsive feel to
  the brightness buttons. Anyhow, seems like a bit of an overkill for
  all these processes to be running especially compared to Xenial.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/policykit-1/+bug/1626651/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to