epoll should nominally support EPOLLEXCLUSIVE
As of version 4.5, Linux as supported the
EPOLLEXCLUSIVE flag on events. The man page describes it as such:
Sets an exclusive wakeup mode for the epoll file descriptor that is being attached to the target file descriptor, fd. When a wakeup event occurs and multiple epoll file descriptors are attached to the same target file using
EPOLLEXCLUSIVE, one or more of the epoll file descriptors will receive an event with
epoll_wait(2). The default in this scenario (when
EPOLLEXCLUSIVEis not set) is for all epoll file descriptors to receive an event.
EPOLLEXCLUSIVEis thus useful for avoiding thundering herd problems in certain scenarios.
If the same file descriptor is in multiple epoll instances, some with the EPOLLEXCLUSIVE flag, and others without, then events will be provided to all epoll instances that did not specify EPOLLEXCLUSIVE, and at least one of the epoll instances that did specify EPOLLEXCLUSIVE.
That final sentence gives us an escape hatch, since it seems that implementing
EPOLLEXCLUSIVE as a no-op would still be correct within the semantics.
Until someone is compelled to implement the full functionality, we should at least provide the same header definition and error handling . (Later parts of the man page describe extra input verification with
Updated by Patrick Mooney 3 months ago
Prior to integration of the change, a run of the latest epoll-test-suite (which passes this test on modern Linux) shows errors:
test_exclusive 0 TWARN: EPOLLEXCLUSIVE not defined test_exclusive 0 TPASS test_exclusive 1 TPASS test_exclusive 2 TFAIL: 0 != -1 test_exclusive 3 TFAIL: 0 != 22 test_exclusive 4 TPASS test_exclusive 5 TPASS test_exclusive 6 TPASS test_exclusive 7 TPASS
Updated by Electric Monk 3 months ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit 66373fa702508a0a41753138f0b10f985c7e058d Author: Patrick Mooney <email@example.com> Date: 2020-07-08T15:06:27.000Z 12902 epoll should nominally support EPOLLEXCLUSIVE Reviewed by: Jerry Jelinek <firstname.lastname@example.org> Reviewed by: Mike Zeller <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>