MINOR: stick-tables: remove the uneeded read lock in stksess_free()
authorWilly Tarreau <w@1wt.eu>
Thu, 23 May 2024 18:31:45 +0000 (20:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 May 2024 09:52:57 +0000 (11:52 +0200)
During changes made in 2.7 by commits 8d3c3336f9 ("MEDIUM: stick-table:
make stksess_kill_if_expired() avoid the exclusive lock") and 996f1a5124
("MEDIUM: stick-table: do not take a lock to update t->current anymore."),
the operation was done cautiously one baby step at a time and the final
cleanup was not done, as we're keeping a read lock under an atomic dec.
Furthermore there's a pool_free() call under that lock, and we try to
avoid pool_alloc() and pool_free() under locks for their nasty side
effects (e.g. when memory gets recompacted), so let's really drop it
now.

Note that the performance gain is not really perceptible here, it's
essentially for code clarity reasons that this has to be done.

src/stick_table.c

index 00049d1..08a22e4 100644 (file)
@@ -130,9 +130,7 @@ void stksess_free(struct stktable *t, struct stksess *ts)
        /* make the compiler happy when shard is not used without threads */
        ALREADY_CHECKED(shard);
 
-       HA_RWLOCK_RDLOCK(STK_TABLE_LOCK, &t->shards[shard].sh_lock);
        __stksess_free(t, ts);
-       HA_RWLOCK_RDUNLOCK(STK_TABLE_LOCK, &t->shards[shard].sh_lock);
 }
 
 /*