Linux Input/HID development
 help / color / mirror / Atom feed
From: "dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>
To: Ryan McClue <re.mcclue@protonmail.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: PROBLEM: Evdev epoll_wait Lag
Date: Fri, 8 Oct 2021 20:19:08 -0700	[thread overview]
Message-ID: <YWEKLNg3ZzGZLpfn@google.com> (raw)
In-Reply-To: <99GfWMtkpJutp6wuEhYJ3aIfNVfE_fr3TVPeQWsr9QSvNMgTk23Aml6WYEucd6D3qkmeIFbunUu6a6g0VNppEKIYrz7w43fzGyl3BUXVkDQ=@protonmail.com>

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

       reply	other threads:[~2021-10-09  3:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <99GfWMtkpJutp6wuEhYJ3aIfNVfE_fr3TVPeQWsr9QSvNMgTk23Aml6WYEucd6D3qkmeIFbunUu6a6g0VNppEKIYrz7w43fzGyl3BUXVkDQ=@protonmail.com>
2021-10-09  3:19 ` dmitry.torokhov [this message]
2021-10-09  4:31   ` PROBLEM: Evdev epoll_wait Lag Ryan McClue
2021-10-10 22:01     ` Ryan McClue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWEKLNg3ZzGZLpfn@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=re.mcclue@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox