powertop(8) Points at gpg-agent.

Ralph Corderoy ralph at inputplus.co.uk
Mon Feb 20 14:32:06 CET 2017


Hi Werner,

> > the forking of two siblings to have a `GETINFO pid' chat every
> > minute.
>
> What you see are not new processes but merely two threads every
> minute.

Yes, sorry, I saw the clone(2) and translated to fork.

> --disable-check-own-socket can be used to disable this feature.

Thanks.  In Arch's 2.1.18-1's agent/gpg-agent.c's handle_connections(),
I see

    if (disable_check_own_socket)
      my_inotify_fd = -1;
    else if ((err = gnupg_inotify_watch_socket (&my_inotify_fd, socket_name)))

and my_inotify_fd is used with select(2).  Does the per minute sibling
thread chat still need to occur in that case?

> >     # define TIMERTICK_INTERVAL          (2)
>
> I have not changed that interval because it is useful when you are
> using smartcards.  What is does is to check the aliveness of scdaemon
> by doing a waitpid (pid, NULL, WNOHANG)).

I don't see a system call with strace for that waitpid though?

    $ strace -tt -f gpg-agent --daemon
    ...
    13:29:23.845564 inotify_init()          = 7
    13:29:23.845704 inotify_add_watch(7, "/run/user/1000/gnupg", IN_DELETE|IN_DELETE_SELF|IN_EXCL_UNLINK) = 1
    13:29:23.845955 pselect6(8, [3 4 5 6 7], NULL, NULL, {tv_sec=1, tv_nsec=999998782}, {[], 8}) = 0 (Timeout)
    13:29:25.848353 pselect6(8, [3 4 5 6 7], NULL, NULL, {tv_sec=2, tv_nsec=30747}, {[], 8}) = 0 (Timeout)
    13:29:27.850760 pselect6(8, [3 4 5 6 7], NULL, NULL, {tv_sec=2, tv_nsec=1343}, {[], 8}) = 0 (Timeout)
    13:29:29.853172 pselect6(8, [3 4 5 6 7], NULL, NULL, {tv_sec=2, tv_nsec=1218}, {[], 8}) = 0 (Timeout)
    13:29:31.855622 pselect6(8, [3 4 5 6 7], NULL, NULL, {tv_sec=2, tv_nsec=1263}, {[], 8}) = 0 (Timeout)
    13:29:33.858052 pselect6(8, [3 4 5 6 7], NULL, NULL, {tv_sec=2, tv_nsec=1409}, {[], 8}) = 0 (Timeout)

Does --disable-scdaemon mean the check isn't needed and select(2) can
stretch to the next longer timeout?

Either way, if the waitpid(WNOHANG) really is happening and strace isn't
showing it, then could a thread not be dedicated to a hanging waitpid(),
with it sending a message on a file descriptor back to the main thread's
select()?

> Not really resource intensive.

No, I agree the work done isn't heavy;  it's the regular periodic
short-term wake-up that's a bit of a pain.

> Note that gpg-agent makes sure that the tick happens on the full
> second

Noted.  Though those `-tt' times from strace above have it creeping
forward, off the second?

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



More information about the Gnupg-users mailing list