vars_prune() and vars_prune_all() take the variable lock while purging
all variables from a head. However this is not needed:
- proc scope variables are only purged during deinit, hence no lock
is needed ;
- all other scopes are attached to entities bound to a single thread
so no lock is needed either.
Removing the lock saves about 0.5% CPU on variables-intensive setups,
but above all simplify the code, so let's do it.
struct var *var, *tmp;
unsigned int size = 0;
- vars_wrlock(vars);
list_for_each_entry_safe(var, tmp, &vars->head, l) {
size += var_clear(var, 1);
}
- vars_wrunlock(vars);
+
var_accounting_diff(vars, sess, strm, -size);
}
struct var *var, *tmp;
unsigned int size = 0;
- vars_wrlock(vars);
list_for_each_entry_safe(var, tmp, &vars->head, l) {
size += var_clear(var, 1);
}
- vars_wrunlock(vars);
if (var_sess_limit)
_HA_ATOMIC_SUB(&vars->size, size);