From: Willy Tarreau Date: Fri, 30 Jul 2021 12:18:49 +0000 (+0200) Subject: BUG/MINOR: pollers: always program an update for migrated FDs X-Git-Tag: v2.5-dev3~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79e90b96158911535c22d1676f7ab8a0e3a9f7af;p=thirdparty%2Fhaproxy.git BUG/MINOR: pollers: always program an update for migrated FDs If an MT-aware poller reports that a file descriptor was migrated, it must stop reporting it. The simplest way to do this is to program an update if not done yet. This will automatically mark the FD for update on next round. Otherwise there's a risk that some events are reported a bit too often and cause extra CPU usage with these pollers. Note that epoll is currently OK regarding this. Select does not need this because it uses a single shared events table, so in case of migration no FD change is expected. This should be backported as far as 2.2. --- diff --git a/src/ev_evports.c b/src/ev_evports.c index 9dc5728c64..109e59c618 100644 --- a/src/ev_evports.c +++ b/src/ev_evports.c @@ -226,6 +226,8 @@ static void _do_poll(struct poller *p, int exp, int wake) if (!(fdtab[fd].thread_mask & tid_bit)) { activity[tid].poll_skip_fd++; + if (!HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid)) + fd_updt[fd_nbupdt++] = fd; continue; } diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index e9ca1ba1b1..d51a833ed2 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -193,6 +193,8 @@ static void _do_poll(struct poller *p, int exp, int wake) if (!(fdtab[fd].thread_mask & tid_bit)) { activity[tid].poll_skip_fd++; + if (!HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid)) + fd_updt[fd_nbupdt++] = fd; continue; } diff --git a/src/ev_poll.c b/src/ev_poll.c index a84fa608fc..c30aadbe1a 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -234,6 +234,8 @@ static void _do_poll(struct poller *p, int exp, int wake) if (!(fdtab[fd].thread_mask & tid_bit)) { activity[tid].poll_skip_fd++; + if (!HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid)) + fd_updt[fd_nbupdt++] = fd; continue; }