vsock: reuse same-flow socket lookup in RX batches
Subsystems (6)
PATCH 3/5 vsock: reuse same-flow socket lookup in RX batches
From: Jia Jia <[email protected]>
An RX lock batch still looks up the socket for every packet and takes a temporary lookup reference, even though the batch already holds a reference to the locked socket.
Record the network namespace and packet address tuple when a batch starts. Reuse the batch socket for later STREAM/RW packets with the same tuple, and release the batch before looking up a different flow.
The cached path still traces every packet, takes an skb owner reference, validates socket state, source and transport, updates credit, and runs the receive state machine. Only the socket table lookup and its temporary reference are skipped.
--- include/linux/virtio_vsock.h | 3 ++ net/vmw_vsock/virtio_transport_common.c | 58 +++++++++++++++---------- 2 files changed, 37 insertions(+), 24 deletions(-)
include/linux/virtio_vsock.h +3 -0
@@ -285,6 +285,9 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,struct virtio_transport_rx_batch {struct sock *sk; +struct net *net; +struct sockaddr_vm src; +struct sockaddr_vm dst; }; void virtio_transport_recv_pkt_batch(struct virtio_transport *t,
net/vmw_vsock/virtio_transport_common.c +34 -24
88 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
From: Jia Jia <[email protected]>
An RX lock batch still looks up the socket for every packet and takes a temporary lookup reference, even though the batch already holds a reference to the locked socket.
Record the network namespace and packet address tuple when a batch starts. Reuse the batch socket for later STREAM/RW packets with the same tuple, and release the batch before looking up a different flow.
Quoted 6 lines
The cached path still traces every packet, takes an skb owner reference, validates socket state, source and transport, updates credit, and runs the receive state machine. Only the socket table lookup and its temporary reference are skipped.
Signed-off-by Jia Jia <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3