> An RX batch can make a socket readable while the worker still owns its
> socket lock. Waking a reader at that point can make it immediately wait
> for the same lock.
> 
> For the callback installed by sock_init_data(), record when the existing
> low-watermark condition is met and issue one notification after the batch
> releases the lock. Save the initial sock_def_readable() callback when the
> AF_VSOCK socket is created because virtio_transport_common can be built as
> a module and cannot refer to that unexported symbol directly.
> 
> When sk_data_ready or sk_write_space no longer matches that initial
> callback, pass queued skbs to the current callback one skb at a time. The
> handoff stops if the callback is the default again or the queue does not
> shrink. After 64 successful callbacks, queue another bounded handoff if
> data remains. vsock_bpf_update_proto() schedules the same handoff so an
> attach or detach outside the worker still drains skbs already queued.
> 
> Always deliver a coalesced write-space event to the saved default callback
> before sampling the callback state. A current replacement is invoked by
> the handoff as well, so a callback change cannot hide the native writer
> wakeup or pending sockmap work.
> 
> Sampling at batch finish takes sk_callback_lock once. The per-packet fast
> path still uses READ_ONCE() and does not take that lock. Control packets,
> state transitions, transport changes and non-batched sockets keep their
> existing behavior.
> 
> Signed-off-by: Jia Jia <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=5


Reply via email to