vsock: Have two separate threads for handling TX and RX
Currently, the VhostUserVsockBackend handles both TX and RX in a single thread. It would be nice to have two separate threads handling TX and RX.
Implementing this would involve the following:
- Define two threads in
VhostUserVsockBackendwith the appropriatequeue_masks:1for the RX thread and2for the TX thread. - Set the TX thread's vring worker to also listen for
BACKEND_EVENTs by callingset_vring_workerduring initialization instart_backend_server. - Handle RX or TX in
VhostUserVsockBackend::handle_eventdepending on thethread_id. - Refactor the hashmaps and
backend_rxqcontained inVsockThreadBackendto be accessible by both the threads (maybe over anRwLock). - Make the option to choose between single-threaded or multi-threaded configurable by the user.
Thank you for the analysis! If you have time and interest to start this work, go ahead, otherwise we'll do it later because it would be a great cleanup.
Yes, I'll get to it in a few days.
Hey i see this hasn't been picked up in quite some time. If no one is picking this up shall i do it?
@ramyak-mehra great! yes please, go head.
IIUC @techiepriyansh is busy, but feel free to ping us if the situation is changed.