cmux: Refactor, test and improve performance of the circuitmux subsystem
The cmux subsystem (src/or/circuitmux.c
) is part of tor's fast path. It gets called at every cell or at every few cell and every new or dying circuit.
It is currently in our top 5 of CPU hugger (see #25152 (moved)) and also has a certain complexity to it. However, in practice, it should be quite simple. #25268 (moved) helps a lot by removing dead code and helping making the code more readable.
In order to improve that subsystem, there are few steps that need to be taken before we can address something like #25152 (moved). Furthermore, in order to fix some things in the scheduler (#23993 (moved)), this work should be done so we don't add more complexity to that code.
Refactoring this subsystem to something more simple also will help testing it for which right now, it is virtually untested (see src/test/test_circuitmux.c
).
I'm taking this ticket because I do have planned out this work already and it might change over time.