]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stick-table: requeue the wakeup task out of the write lock
authorWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 10:04:01 +0000 (10:04 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 12:19:05 +0000 (14:19 +0200)
We don't need to call stktable_requeue_exp() with the table's lock
held anymore, so let's move it out. It should slightly reduce the
contention on the write lock, though it is now already quite low.

src/stick_table.c

index 57c1b177571c1870133eb86c8ce46907de83383e..c9f1fda3a93c57c106762dab44d3592c948e3cc0 100644 (file)
@@ -566,10 +566,10 @@ struct stksess *stktable_get_entry(struct stktable *table, struct stktable_key *
                ts = ts2;
        }
 
-       stktable_requeue_exp(table, ts);
        HA_ATOMIC_INC(&ts->ref_cnt);
        HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &table->lock);
 
+       stktable_requeue_exp(table, ts);
        return ts;
 }
 
@@ -604,8 +604,9 @@ struct stksess *stktable_set_entry(struct stktable *table, struct stksess *nts)
        /* now we're write-locked */
 
        __stktable_store(table, ts);
-       stktable_requeue_exp(table, ts);
        HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &table->lock);
+
+       stktable_requeue_exp(table, ts);
        return ts;
 }