Re: PROBLEM: Evdev epoll_wait Lag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want the epoll_wait to return immediately if no data, so I believe the timeout of 0 is correct.
I'm using an adapted version of this loop for a hobby program. However, every time I open it up in a debugger (or just normally) htop shows CPU usage for the process is ~97% and the CPU fan becomes very loud.
Like I said, I'm experiencing stalls from a fresh install of Ubuntu in all native applications like gnome-terminal, firefox, gedit, vi etc.
I don't understand what is going on or how to go about debugging it.

--
Ryan McClue, Sydney

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Saturday, October 9th, 2021 at 2:19 PM, dmitry.torokhov@xxxxxxxxx <dmitry.torokhov@xxxxxxxxx> wrote:

> Hi,
>
> On Fri, Oct 08, 2021 at 11:29:51PM +0000, Ryan McClue wrote:
>
> > Hi there,
> >
> > PROBLEM:
> >
> > I'm on a laptop, with 2 connected keyboards (built-in and USB).
> >
> > When I hit keys on each keyboard simultaneously in a program like firefox,
> >
> > gnome-terminal etc. stalling/lag occurs.
> >
> > It only happens for keyboards it seems as moving an external mouse and trackpad
> >
> > together causes no issues.
> >
> > TO REPRODUCE:
> >
> > To investigate the problem I wrote a simple C file
> >
> > (see attached 'evdev-lag.c', compile with $(gcc evdev-lag.c -o evdev-lag))
> >
> > The program finds keyboard devices under /dev/input/event and uses epoll to
> >
> > poll them for input via the evdev interface.
> >
> > If I start entering keys on one keyboard and then switch to the other, the
> >
> > program stalls briefly.
> >
> > If I simultaneously enter keys on each keyboard the program stalls indefinitely
> >
> > until I stop entering keys.
>
> I do not observe stalls but did you mean to essentially busy-loop in
>
> your program? epoll_wait with 0 timeout causes it return immediately,
>
> you want to use -1 if you want to wait indefinitely or give it a real
>
> timeout.
>
> Thanks.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Dmitry




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux