]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: Don't use atomic operations when it's not needed.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 12 Jun 2019 12:31:08 +0000 (14:31 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 12 Jun 2019 12:36:24 +0000 (14:36 +0200)
In updt_fd_polling(), when updating fd_nbupdt, there's no need to use an
atomic operation, as it's a TLS variable.

include/proto/fd.h

index 745c4fe458a7ea4aa981280bb13a623e9256b92b..2efd1d3615271fc90787f872c5a79a355437592f 100644 (file)
@@ -117,15 +117,13 @@ void fd_rm_from_fd_list(volatile struct fdlist *list, int fd, int off);
 static inline void updt_fd_polling(const int fd)
 {
        if ((fdtab[fd].thread_mask & all_threads_mask) == tid_bit) {
-               unsigned int oldupdt;
 
                /* note: we don't have a test-and-set yet in hathreads */
 
                if (HA_ATOMIC_BTS(&fdtab[fd].update_mask, tid))
                        return;
 
-               oldupdt = _HA_ATOMIC_ADD(&fd_nbupdt, 1) - 1;
-               fd_updt[oldupdt] = fd;
+               fd_updt[fd_nbupdt++] = fd;
        } else {
                unsigned long update_mask = fdtab[fd].update_mask;
                do {