Fix: move wait loop increment before first conditional block
[userspace-rcu.git] / urcu-qsbr.c
index 76aaabb4eac85fbb11aefc487bab627aa241a384..a2cabb446afda2db312b6d42a00b8ea5f02a4769 100644 (file)
@@ -150,6 +150,8 @@ static void update_counter_and_wait(void)
         * Wait for each thread rcu_reader_qs_gp count to become 0.
         */
        for (;;) {
+               if (wait_loops < RCU_QS_ACTIVE_ATTEMPTS)
+                       wait_loops++;
                if (wait_loops >= RCU_QS_ACTIVE_ATTEMPTS) {
                        uatomic_set(&gp_futex, -1);
                        /*
@@ -162,8 +164,6 @@ static void update_counter_and_wait(void)
                        }
                        /* Write futex before read reader_gp */
                        cmm_smp_mb();
-               } else {
-                       wait_loops++;
                }
                cds_list_for_each_entry_safe(index, tmp, &registry, node) {
                        if (!rcu_gp_ongoing(&index->ctr))
This page took 0.022546 seconds and 4 git commands to generate.