> > On Fri, Nov 06, 2026 at 08:49:17PM +0800, Jia Jia wrote: > > > > > > On Tue, Nov 03, 2026 at 12:11:33PM +0800, Jia Jia wrote: > > > >Each received packet can update peer credit and call sk_write_space(). A > > > >writer cannot consume that credit while the virtio RX worker retains the > > > >socket lock, so repeated native write-space notifications in one RX batch > > > >are unnecessary. > > > > > > > >This patch coalesces write-space notifications on the native AF_VSOCK > > > >path; > > > >data-ready remains per-packet here. > > > > > > > >The batching patch establishes batch ownership before its first packet. > > > >This lets this patch record a pending notification for that packet and > > > >flush it even if the packet immediately ends the batch. Deliver it while > > > >holding the socket lock to preserve the callback context of the existing > > > >receive path. A following patch changes that timing together with > > > >data-ready handling. > > > > > > Can you report performance data related to this patch also here? > > > > > > IIUC this is not giving a lot of advantage, so my question is if this > > > more complexity really add a value for us. > > > > > > > Sure. The performance tests currently cover patches 4 and 5 together, > > so I will include those results here. > > > > They do not add another broad throughput improvement. I kept the > > combined notification change because of the cycles/byte results. > > > > With P1-P3 only, against baseline: > > > > Buffer size baseline cycles/B PATCH cycles/B cycles change (95% CI) > > 64B 66.728 61.220 -8.25% [-18.99%, +3.91%] > > 256B 14.363 14.515 +1.06% [ -4.22%, +6.64%] > > 512B 7.792 7.578 -2.74% [ -6.55%, +1.23%] > > 1K 3.988 4.032 +1.09% [ -1.64%, +3.88%] > > 4K 2.063 1.973 -4.38% [ -8.23%, -0.37%] > > 8K 1.702 1.667 -2.06% [ -7.99%, +4.25%] > > 16K 1.473 1.475 +0.17% [ -5.06%, +5.68%] > > 64K 1.385 1.358 -1.96% [-10.61%, +7.53%] > > > > Only the 4K interval excluded zero. With the full series, against > > baseline: > > > > Buffer size baseline cycles/B PATCH cycles/B cycles change (95% CI) > > 64B 65.282 57.843 -11.40% [-13.77%, -8.95%] > > 256B 14.710 13.813 -6.10% [ -7.89%, -4.28%] > > 512B 7.709 7.188 -6.75% [ -8.79%, -4.66%] > > 1K 4.075 3.862 -5.23% [ -6.80%, -3.63%] > > 4K 2.034 1.887 -7.21% [ -8.67%, -5.72%] > > 8K 1.664 1.568 -5.78% [ -7.83%, -3.69%] > > 16K 1.450 1.385 -4.48% [ -6.08%, -2.86%] > > 64K 1.338 1.317 -1.51% [ -3.21%, +0.22%] > > > > From 64B through 16K those intervals stay below zero. 64B through 1K > > did not show that in the P1-P3 run. > > > > This is also why I spent the time making this work with sockmap. > > > > The value I see is lower RX CPU cost, not another large throughput > > gain. I am still unsure the extra code is worth it, and I would like > > your opinion. > > Thanks for the numbers! > > Both tables are against baseline, but the two baselines are a bit > different (e.g. 66.728 vs 65.282 for 64B), so it's not easy to see the > real contribution of P4/P5. Can you compare the full series directly > against P1-P3? > > Anyway, IMO the big win of this series is P1-P3 (throughput), while > P4/P5 add a lot of complexity (saved native callbacks, new af_vsock > helpers, sk_callback_lock, sockmap corner cases) for a ~5% of CPU > cost, without throughput improvement. >
I ran a direct A/B comparison on top of the base batching patches: reader TID cycles/B dropped up to ~2.3%, and guest CPU1 aggregate cycles/B dropped 4.4-5.8%, which matches your ~5% estimate. Guest reader PID/TID (cycles/B): Buf P1-P3 +P4/P5 change (95% CI) 64B 7.032 6.963 -0.99% [-2.52%, +0.57%] 256B 4.323 4.256 -1.55% [-2.82%, -0.26%] 512B 2.296 2.257 -1.71% [-3.35%, -0.05%] 1K 1.313 1.303 -0.79% [-2.50%, +0.94%] 4K 0.744 0.727 -2.19% [-3.46%, -0.90%] 8K 0.611 0.597 -2.26% [-3.52%, -0.99%] 16K 0.535 0.534 -0.29% [-1.48%, +0.90%] 64K 0.512 0.513 +0.36% [-0.43%, +1.16%] Guest CPU0 aggregate (cycles/B): Buf P1-P3 +P4/P5 change (95% CI) 64B 21.688 21.049 -2.94% [-6.02%, +0.23%] 256B 8.333 7.892 -5.29% [-7.02%, -3.53%] 512B 4.448 4.240 -4.67% [-6.13%, -3.19%] 1K 2.497 2.382 -4.58% [-6.81%, -2.29%] 4K 1.302 1.227 -5.73% [-7.26%, -4.17%] 8K 1.050 1.013 -3.51% [-4.37%, -2.65%] 16K 0.953 0.925 -2.98% [-4.79%, -1.13%] 64K 0.842 0.805 -4.29% [-5.75%, -2.81%] Guest CPU1 aggregate (cycles/B): Buf P1-P3 +P4/P5 change (95% CI) 64B 48.985 46.388 -5.30% [-6.36%, -4.23%] 256B 11.194 10.704 -4.38% [-5.48%, -3.26%] 512B 5.886 5.592 -4.99% [-6.00%, -3.98%] 1K 3.080 2.945 -4.36% [-5.61%, -3.09%] 4K 1.508 1.421 -5.80% [-6.67%, -4.92%] 8K 1.215 1.160 -4.51% [-5.64%, -3.36%] 16K 1.079 1.029 -4.66% [-5.87%, -3.44%] 64K 0.941 0.894 -5.01% [-6.34%, -3.66%] > So my suggestion is to split the series: send P1-P3 first, so we can > focus the review on them and merge them, and then send P4/P5 (squashed) > as a separate series. That way we can also evaluate the direction > suggested by Bobby (batching in read_skb() + coalesced sk_data_ready(), > like TCP), that may allow us to avoid saving the native callbacks at > all. > > WDYT? > Sounds good to me. I'll split out P4/P5 and send just the two core RX batching patches in v6 (dropping P2 as discussed in the P3 thread). We can look into the notification changes and Bobby's read_skb() idea separately after that. Thanks, Jia > Thanks, > Stefano >
