Skip to content

Replace netievent lock-free queue with simple locked queue [v9.16]

Ondřej Surý requested to merge ondrej-use-locked-queue-v9_16 into v9_16

The current implementation of isc_queue uses Michael-Scott lock-free queue that in turn uses hazard pointers. It was discovered that the way we use the isc_queue, such complicated mechanism isn't really needed, because most of the time, we either execute the work directly when on nmthread (in case of UDP) or schedule the work from the matching nmthreads.

Replace the current implementation of the isc_queue with a simple locked ISC_LIST. There's a slight improvement - since copying the whole list is very lightweight - we move the queue into a new list before we start the processing and locking just for moving the queue and not for every single item on the list.

NOTE: There's a room for future improvements - since we don't guarantee the order in which the netievents are processed, we could have two lists

  • one unlocked that would be used when scheduling the work from the matching thread and one locked that would be used from non-matching thread.

Backport of !5914 (merged)

Closes #3372 (closed)

Edited by Michał Kępień

Merge request reports