Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • L libevdev
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • libevdev
  • libevdev
  • Merge requests
  • !4

Don't read events unless required

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Peter Hutterer requested to merge whot/libevdev:wip/reduce-reads into master Jan 16, 2019
  • Overview 0
  • Commits 1
  • Pipelines 2
  • Changes 3

With the previous approach, every libevdev_next_event() invocation triggered a read() on the device fd. This is not efficient, the kernel provides whole event frames at a time so we're guaranteed to have more events waiting unless the current event is a SYN_REPORT.

Assuming a fast-enough client and e.g. a touchpad device with multiple axes per frame, we'd thus trigger several unnecessary read() calls per event frame.

Drop this behavior, instead only trigger the read when our internal queue is empty and we need more events.

Fallout:

  • we don't have any warning about a too-slow sync, i.e. if a SYN_DROPPED arrives while we're syncing, we don't get a warning in the log anymore. the test for this was removed.
  • the tests that required the specific behavior were rewritten accordingly
  • a revoke on a kernel device doesn't return ENODEV until already-received events have been processed

The above shouldn't be an issue for existing real-world clients.

Fixes #7 (closed)

cc @bentiss

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: wip/reduce-reads