The write lock in stktable_touch_with_exp() is quite expensive and should
be shortened as much as possible. There's no need for it when calling
task_wakeup() so let's move it out.
On a 80-thread machine with a peers section, the request rate increased
from 397k to 415k rps.
{
struct eb32_node * eb;
int locked = 0;
+ int do_wakeup = 0;
if (expire != HA_ATOMIC_LOAD(&ts->expire)) {
/* we'll need to set the expiration and to wake up the expiration timer .*/
eb32_insert(&t->updates, &ts->upd);
}
}
- task_wakeup(t->sync_task, TASK_WOKEN_MSG);
+ do_wakeup = 1;
}
else {
/* If this entry is not in the tree */
if (locked)
HA_RWLOCK_WRUNLOCK(STK_TABLE_LOCK, &t->lock);
+
+ if (do_wakeup)
+ task_wakeup(t->sync_task, TASK_WOKEN_MSG);
}
/* Update the expiration timer for <ts> but do not touch its expiration node.