[systemd-devel] [PATCH 1/2] Remove the cap on epoll events

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Mar 4 18:44:29 PST 2015


On Wed, Mar 04, 2015 at 04:32:16PM +0100, Hannes Reinecke wrote:
> Currently the code will silently blank out events
> if there are more then 512 epoll events, causing them
> never to be handled at all.
> This patch removes the cap on the number of events
> for epoll_wait, thereby avoiding this issue.
> 
> Signed-off-by: Hannes Reinecke <hare at suse.de>
Applied, without SOB, and with MAX() added.

Zbyszek

> ---
>  src/libsystemd/sd-event/sd-event.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
> index 0c4e517..8eb154c 100644
> --- a/src/libsystemd/sd-event/sd-event.c
> +++ b/src/libsystemd/sd-event/sd-event.c
> @@ -36,7 +36,6 @@
>  
>  #include "sd-event.h"
>  
> -#define EPOLL_QUEUE_MAX 512U
>  #define DEFAULT_ACCURACY_USEC (250 * USEC_PER_MSEC)
>  
>  typedef enum EventSourceType {
> @@ -2366,7 +2365,7 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
>                  return 1;
>          }
>  
> -        ev_queue_max = CLAMP(e->n_sources, 1U, EPOLL_QUEUE_MAX);
> +        ev_queue_max = e->n_sources > 0 ? e->n_sources : 1;
>          ev_queue = newa(struct epoll_event, ev_queue_max);
>  
>          m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,
> -- 
> 1.8.4.5
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list