diff options
| author | Valentin Bartenev <vbart@nginx.com> | 2016-07-15 15:18:57 +0300 |
|---|---|---|
| committer | Valentin Bartenev <vbart@nginx.com> | 2016-07-15 15:18:57 +0300 |
| commit | 5c2dd3913aad5c4bf7d9056e1336025c2703586b (patch) | |
| tree | 8569c90681ada207b182ff4b583225c7a70f3d9e /src/event/modules | |
| parent | b60534e0d8f943740fb6847ac0a1ff3091a373d0 (diff) | |
| download | nginx-5c2dd3913aad5c4bf7d9056e1336025c2703586b.tar.gz nginx-5c2dd3913aad5c4bf7d9056e1336025c2703586b.tar.bz2 | |
Events: support for EPOLLEXCLUSIVE.
This flag appeared in Linux 4.5 and is useful for avoiding thundering herd
problem.
The current Linux kernel implementation walks the list of exclusive waiters,
and queues an event to each epfd, until it finds the first waiter that has
threads blocked on it via epoll_wait().
Diffstat (limited to 'src/event/modules')
| -rw-r--r-- | src/event/modules/ngx_epoll_module.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c index dff778831..c267fd6c7 100644 --- a/src/event/modules/ngx_epoll_module.c +++ b/src/event/modules/ngx_epoll_module.c @@ -27,6 +27,7 @@ #define EPOLLRDHUP 0x2000 +#define EPOLLEXCLUSIVE 0x10000000 #define EPOLLONESHOT 0x40000000 #define EPOLLET 0x80000000 @@ -610,6 +611,12 @@ ngx_epoll_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) op = EPOLL_CTL_ADD; } +#if (NGX_HAVE_EPOLLEXCLUSIVE && NGX_HAVE_EPOLLRDHUP) + if (flags & NGX_EXCLUSIVE_EVENT) { + events &= ~EPOLLRDHUP; + } +#endif + ee.events = events | (uint32_t) flags; ee.data.ptr = (void *) ((uintptr_t) c | ev->instance); |
