]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: pollers: always program an update for migrated FDs
authorWilly Tarreau <w@1wt.eu>
Fri, 30 Jul 2021 12:18:49 +0000 (14:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 30 Jul 2021 12:21:43 +0000 (14:21 +0200)
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.

src/ev_evports.c
src/ev_kqueue.c
src/ev_poll.c

index 9dc5728c648e8eac4810d8fba8dea9d115b391d4..109e59c618e1a52053860fa26b329b4999bbff6c 100644 (file)
@@ -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;
                }
 
index e9ca1ba1b19d3bcf1f4c8332a038cb781d286a91..d51a833ed2f2df549cc9716dd682598e968ef75e 100644 (file)
@@ -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;
                }
 
index a84fa608fcf9279e162578efb9ae325c7af533e2..c30aadbe1aeb2e282068d374c3154f158a199fa0 100644 (file)
@@ -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;
                }