Commit d29edf9
ZEN: Input: evdev - use call_rcu when detaching client
Significant time was spent on synchronize_rcu in evdev_detach_client
when applications closed evdev devices. Switching VT away from a
graphical environment commonly leads to mass input device closures,
which could lead to noticable delays on systems with many input devices.
Replace synchronize_rcu with call_rcu, deferring reclaim of the evdev
client struct till after the RCU grace period instead of blocking the
calling application.
While this does not solve all slow evdev fd closures, it takes care of a
good portion of them, including this simple test:
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int idx, fd;
const char *path = "/dev/input/event0";
for (idx = 0; idx < 1000; idx++) {
if ((fd = open(path, O_RDWR)) == -1) {
return -1;
}
close(fd);
}
return 0;
}
Time to completion of above test when run locally:
Before: 0m27.111s
After: 0m0.018s
Signed-off-by: Kenny Levinsen <kl@kl.wtf>1 parent 0ef35bd commit d29edf9
1 file changed
Lines changed: 11 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
380 | 390 | | |
381 | 391 | | |
382 | 392 | | |
383 | 393 | | |
384 | 394 | | |
385 | 395 | | |
386 | | - | |
| 396 | + | |
387 | 397 | | |
388 | 398 | | |
389 | 399 | | |
| |||
436 | 446 | | |
437 | 447 | | |
438 | 448 | | |
439 | | - | |
440 | 449 | | |
441 | 450 | | |
442 | 451 | | |
| |||
448 | 457 | | |
449 | 458 | | |
450 | 459 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | 460 | | |
457 | 461 | | |
458 | 462 | | |
| |||
495 | 499 | | |
496 | 500 | | |
497 | 501 | | |
498 | | - | |
499 | 502 | | |
500 | 503 | | |
501 | 504 | | |
| |||
0 commit comments