input/evdev: make evdev use keyed wakeups
Subsystems (2)
PATCH 1/1 input/evdev: make evdev use keyed wakeups
Some processes, such as systemd, are only polling for EPOLLERR|EPOLLHUP. As evdev uses unkeyed wakeups, such a poll receives many spurious wakeups from uninteresting events.
Use keyed wakeups to allow the wakeup target to more efficiently discard these uninteresting events.
Signed-off-by Kenny Levinsen <[email protected]>
--- drivers/input/evdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/input/evdev.c +4 -3
@@ -282,7 +282,8 @@ static void evdev_pass_values(struct evdev_client *client,spin_unlock (&client->buffer_lock);if (wakeup) -wake_up_interruptible (&evdev->wait); +wake_up_interruptible_poll (&evdev->wait, +EPOLLIN |EPOLLOUT |EPOLLRDNORM |EPOLLWRNORM ); }/*
@@ -443,7 +444,7 @@ static void evdev_hangup(struct evdev *evdev)kill_fasync (&client->fasync,SIGIO ,POLL_HUP );spin_unlock (&evdev->client_lock); -wake_up_interruptible (&evdev->wait); +wake_up_interruptible_poll (&evdev->wait,EPOLLHUP |EPOLLERR ); }static int evdev_release (struct inode *inode,struct file *file)
@@ -958,7 +959,7 @@ static int evdev_revoke(struct evdev *evdev, struct evdev_client *client, client->revoked = true;evdev_ungrab (evdev, client);input_flush_device (&evdev->handle, file); -wake_up_interruptible (&evdev->wait); +wake_up_interruptible_poll (&evdev->wait,EPOLLHUP |EPOLLERR );return 0 ; }
Signature · 1 line
2.26.0
Quoted 8 lines · Kenny Levinsen
Some processes, such as systemd, are only polling for EPOLLERR|EPOLLHUP. As evdev uses unkeyed wakeups, such a poll receives many spurious wakeups from uninteresting events.
Use keyed wakeups to allow the wakeup target to more efficiently discard these uninteresting events.
Signed-off-by Kenny Levinsen <[email protected]>
Applied, thank you.
Quoted 39 lines
--- drivers/input/evdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/input/evdev.c +4
-3@@ -282,7 +282,8 @@ static void evdev_pass_values(struct evdev_client *client,spin_unlock (&client->buffer_lock);if (wakeup) -wake_up_interruptible (&evdev->wait); +wake_up_interruptible_poll (&evdev->wait, +EPOLLIN |EPOLLOUT |EPOLLRDNORM |EPOLLWRNORM ); }/* @@ -443,7 +444,7 @@ static void evdev_hangup(struct evdev *evdev)kill_fasync (&client->fasync,SIGIO ,POLL_HUP );spin_unlock (&evdev->client_lock); -wake_up_interruptible (&evdev->wait); +wake_up_interruptible_poll (&evdev->wait,EPOLLHUP |EPOLLERR ); }static int evdev_release (struct inode *inode,struct file *file)@@ -958,7 +959,7 @@ static int evdev_revoke(struct evdev *evdev, struct evdev_client *client, client->revoked = true;evdev_ungrab (evdev, client);input_flush_device (&evdev->handle, file); -wake_up_interruptible (&evdev->wait); +wake_up_interruptible_poll (&evdev->wait,EPOLLHUP |EPOLLERR );return 0 ; }Signature · 1 line
2.26.0
Signature · 1 line
Dmitry