Skip to content

Commit 81b4d1d

Browse files
kennylevinsendtor
authored andcommitted
Input: 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent ec4ba6c commit 81b4d1d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/input/evdev.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ static void evdev_pass_values(struct evdev_client *client,
282282
spin_unlock(&client->buffer_lock);
283283

284284
if (wakeup)
285-
wake_up_interruptible(&evdev->wait);
285+
wake_up_interruptible_poll(&evdev->wait,
286+
EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM);
286287
}
287288

288289
/*
@@ -443,7 +444,7 @@ static void evdev_hangup(struct evdev *evdev)
443444
kill_fasync(&client->fasync, SIGIO, POLL_HUP);
444445
spin_unlock(&evdev->client_lock);
445446

446-
wake_up_interruptible(&evdev->wait);
447+
wake_up_interruptible_poll(&evdev->wait, EPOLLHUP | EPOLLERR);
447448
}
448449

449450
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,
958959
client->revoked = true;
959960
evdev_ungrab(evdev, client);
960961
input_flush_device(&evdev->handle, file);
961-
wake_up_interruptible(&evdev->wait);
962+
wake_up_interruptible_poll(&evdev->wait, EPOLLHUP | EPOLLERR);
962963

963964
return 0;
964965
}

0 commit comments

Comments
 (0)