help gpg-agent be more idle

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Nov 1 06:11:32 CET 2016


A patch series follows that aims to help gpg-agent tread more lightly
on the system it uses, at least on non-Windows systems.  In
particular, on my GNU/Linux system, a default gpg-agent process wakes
up every two seconds and then immediately goes back to sleep.

This represents a potential problem for power management, and suggests
that there is room for improvement at least in the default case where
gpg-agent is mostly idle.  This is similar to the recent patch series
i submitted about helping dirmngr be more idle, but focused on
gpg-agent instead.

With these patches applied, an idle gpg-agent on non-Windows platforms
is actually idle for up to 60 seconds at a time -- waiting in the
kernel's select() for activity to wake it up, or checking on its own
sockets every minute.

Even better, on platforms which support inotify both at compile-time
and at run-time, gpg-agent is completely idle, since inotify removes
the need for scheduled checks of control of the socket.  The process
is no less responsive to the user, and it doesn't burn CPU it doesn't
need.

However, if gpg-agent launches scdaemon, then these optimizations go
away, and gpg-agent falls back to its usual every-two-seconds wakeups
to verify the status of the scdaemon.  scdaemon itself wakes up every
0.5 seconds, so handling the idle case with scdaemon running will take
more work.  However, the following patch series is still a win for
every user who doesn't run scdaemon, so i hope it will be considered.

Comments welcome!

Regards,

        --dkg



More information about the Gnupg-devel mailing list