Currently invoking eventhandler(9) event via fastest method, EVENTHANDLER_DIRECT_INVOKE(), involves locking/unlocking event handler list mutex on each call. This may be a bit problematic for events running with high frequency.
The diff below adds another variation of eventhandler(9), leveraging epoch for list traversal.
New KPI semantics: EVENTHANDLER_DEFINE_EPOCH(name, epoch_pointer), EVENTHANDLER_REGISTER_EPOCH(name, epoch, func, arg, prority), EVENTHANDLER_INVOKE_EPOCH(name).
Implementation details:
Item list in the eventhandler_list had to be converted from TAILQ to the LIST, as there is no TAILQ support in ck. In fact, the only place where TAILQ was really used was the worst case when registering new listener. There, the code first traversed the entire list to compare the relative priorities and used tail insertion only if all other priorities were better. Converting the rest invocations to the CK_LIST was straight-forwarded.
Internally eventhandler_list stores pointer to epoch_t. The reason is that event handler lists are allocated at SI_SUB_EVENTHANDLER time, which is much earlier than SI_SUB_EPOCH (where epochs are allocated). Thus, the code stores pointer to the variable that will hold the epoch pointer instead.