Re: [PATCH v2] fs: Improve eventpoll logging to stop indicting timerfd

From: Manish Varma
Date: Thu Apr 01 2021 - 19:57:47 EST


Hi Al,

On Wed, Mar 31, 2021 at 7:29 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 31, 2021 at 07:16:45PM -0700, Manish Varma wrote:
> > timerfd doesn't create any wakelocks, but eventpoll can. When it does,
> > it names them after the underlying file descriptor, and since all
> > timerfd file descriptors are named "[timerfd]" (which saves memory on
> > systems like desktops with potentially many timerfd instances), all
> > wakesources created as a result of using the eventpoll-on-timerfd idiom
> > are called... "[timerfd]".
> >
> > However, it becomes impossible to tell which "[timerfd]" wakesource is
> > affliated with which process and hence troubleshooting is difficult.
> >
> > This change addresses this problem by changing the way eventpoll
> > wakesources are named:
> >
> > 1) the top-level per-process eventpoll wakesource is now named "epoll:P"
> > (instead of just "eventpoll"), where P, is the PID of the creating
> > process.
> > 2) individual per-underlying-filedescriptor eventpoll wakesources are
> > now named "epollitemN:P.F", where N is a unique ID token and P is PID
> > of the creating process and F is the name of the underlying file
> > descriptor.
> >
> > All together that should be splitted up into a change to eventpoll and
> > timerfd (or other file descriptors).
>
> FWIW, it smells like a variant of wakeup_source_register() that would
> take printf format + arguments would be a good idea. I.e. something
> like
>
> > + snprintf(buf, sizeof(buf), "epoll:%d", task_pid);
> > + epi->ep->ws = wakeup_source_register(NULL, buf);
>
> ... = wakeup_source_register(NULL, "epoll:%d", task_pid);
>
> etc.

Noted. I will fix this in the v3 patch.

Thanks,
Manish