From: Olivier Houchard Date: Wed, 5 Nov 2025 18:18:21 +0000 (+0100) Subject: MEDIUM: stick-tables: Optimize the expiration process a bit. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=201971ec5fb4232bcf95a36fb9ea7d4b6ef1c844;p=thirdparty%2Fhaproxy.git MEDIUM: stick-tables: Optimize the expiration process a bit. In process_tables_expire(), if the table we're analyzing still has entries, and thus should be put back into the tree, do not put it in the mt_list, to have it put back into the tree the next time the task runs. There is no problem with putting it in the tree right away, as either the next expiration is in the future, or we handled the maximum number of expirations per task call and we're about to stop, anyway. This does not need to be backported. --- diff --git a/src/stick_table.c b/src/stick_table.c index 3f8eeb229..d8c5b4a55 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -1128,14 +1128,13 @@ struct task *process_tables_expire(struct task *task, void *context, unsigned in HA_ATOMIC_CAS(&t->shards[shard].next_exp, &old_exp, next_exp_table); } - eb32_delete(table_eb); - table_eb->key = TICK_ETERNITY; /* - * If there's more entry, just put it back into the list, - * it'll go back into the tree the next time the task runs. + * Move the table to its next expiration date, if any. */ + eb32_delete(table_eb); + table_eb->key = next_exp_table; if (next_exp_table != TICK_ETERNITY) - MT_LIST_TRY_APPEND(&per_bucket[shard].toadd_tables, &t->shards[shard].in_bucket_toadd); + eb32_insert(&ps->tables, table_eb); } table_eb = tmpnode; }