From 0bda33a3ec0ad52e0d788f97d17859449fe870f9 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 23 May 2024 20:31:45 +0200 Subject: [PATCH] MINOR: stick-tables: remove the uneeded read lock in stksess_free() 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 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/stick_table.c b/src/stick_table.c index 00049d1c31..08a22e4085 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -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); } /* -- 2.47.3