]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: evports: permit to report multiple events at once
authorWilly Tarreau <w@1wt.eu>
Wed, 17 Apr 2024 14:37:04 +0000 (16:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 17 Apr 2024 14:37:04 +0000 (16:37 +0200)
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.

src/ev_evports.c

index 0acded2f81aa69d3b2929dbe51cd7085aee4121d..0d6828769a5f1919d8f22f53e2916b89f9b29c89 100644 (file)
@@ -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;