This series introduces an optimization for vsock/virtio to reduce latency: When the guest sends a packet to the host, and the workqueue is empty, if there is enough space, the packet is put directly in the virtqueue. In this v2 I replaced a mutex_lock with a mutex_trylock because it was inside a RCU critical section. I also added a check on tx_run, so if the module is being removed the packet is not queued. I'd like to thank Stefano for reporting the tx_run issue. v1->v2 Applied all Stefano's suggestions: - Minor code style changes - Minor commit text rewrite Performed more experiments: - Check if all the packets go directly to the vq (Matias' suggestion) - Used iperf3 to see if there is any improvement in overall throughput from guest to host - Pinned the vhost process to a pCPU. - Run fio using 512B payload Rebased on latest net-next Signed-off-by: Luigi Leonardi <luigi.leonardi@xxxxxxxxxxx> --- Marco Pinna (2): vsock/virtio: refactor virtio_transport_send_pkt_work vsock/virtio: avoid enqueue packets when work queue is empty net/vmw_vsock/virtio_transport.c | 171 +++++++++++++++++++++++++-------------- 1 file changed, 109 insertions(+), 62 deletions(-) --- base-commit: 2e7b471121b09e7fa8ffb437bfa0e59d13f96053 change-id: 20240701-pinna-611e8b6cdda0 Best regards, -- Luigi Leonardi <luigi.leonardi@xxxxxxxxxxx>