From: Willy Tarreau Date: Wed, 17 Apr 2024 14:37:04 +0000 (+0200) Subject: MEDIUM: evports: permit to report multiple events at once X-Git-Tag: v3.0-dev8~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6662bf706;p=thirdparty%2Fhaproxy.git MEDIUM: evports: permit to report multiple events at once Since the beginning in 2.0 the nevlist parameter was set to 1 before calling port_getn(), which means that a single FD event will be reported per polling loop. This is extremely inefficient, and all the code was designed to use global.tune.maxpollevents. It looks like it's a leftover of a temporary debugging change. No apparent issues were found by setting it to a higher value, so better do that. That code is not much used nowadays with Solaris disappearing from the landscape, so even if this definitely was a bug, it's preferable not to backport that fix as it could uncover other subtle bugs that were never raised yet. --- diff --git a/src/ev_evports.c b/src/ev_evports.c index 0acded2f81..0d6828769a 100644 --- a/src/ev_evports.c +++ b/src/ev_evports.c @@ -185,7 +185,7 @@ static void _do_poll(struct poller *p, int exp, int wake) do { int timeout = (global.tune.options & GTUNE_BUSY_POLLING) ? 0 : wait_time; int interrupted = 0; - nevlist = 1; /* desired number of events to be retrieved */ + nevlist = global.tune.maxpollevents; /* desired number of events to be retrieved */ timeout_ts.tv_sec = (timeout / 1000); timeout_ts.tv_nsec = (timeout % 1000) * 1000000;