Repository navigation
Conversation
* homa_dispatch_pkts holds the RPC lock while it processes a batch of packets for one RPC, but homa_data_pkt handed the RPC off on the first packet of the batch (homa_rpc_alloc_server did so even before the packet was queued). The woken thread then asked for the RPC lock while SoftIRQ still needed it, so SoftIRQ released the lock in the middle of the batch and waited to get it back. * Now homa_data_pkt hands the RPC off after it queues the last packet of its batch (skb->next is NULL, read before the packet is queued), and homa_rpc_alloc_server no longer hands off. A batch of one packet is handed off as before.
|
Thanks for the PR and the performance measurements. I like the fix, except for its location. Adding the check of skb->next in homa_data_pkt is information leakage: that function doesn't currently know anything about batches of packets. Can you move the code to homa_dispatch_pkts, which does know about batches? For example, I think it might fit well next to the call to homa_grant_check_rpc. BTW, the original reason for calling homa_rpc_handoff in homa_rpc_alloc_server was to reduce the number of acquisitions of the socket lock: that function already has to acquire the lock for other reasons, and the idea was to invoke homa_rpc_handoff while still holding the socket (otherwise it would have to be acquired again later). However, at some point it seems that lock usage in homa_rpc_alloc_server changed so that it releases the socket lock and then homa_rpc_handoff acquires it again. Thus the motivation for calling homa_rpc_handoff in homa_rpc_alloc_server no longer exists (and it was somewhat ugly and information-leaky to have it there). So I'm glad to get rid of that, particularly since it doesn't seem to hurt performance. |
homa_dispatch_pktsholds the RPC lock while it gives a batch of packets of one RPC tohoma_data_pkt. Buthoma_data_pkthands the RPC off on the first packet of the batch. The woken thread setsAPP_NEEDS_LOCKwhile SoftIRQ still has packets of that batch, so SoftIRQ releases the lock and waits for the thread.This patch hands the RPC off after
homa_data_pktqueues the last packet of its batch (skb->nextis NULL), andhoma_rpc_alloc_serverno longer hands off. A batch of one packet is handed off as before.cp_node on two CloudLab xl170 nodes (SMT, turbo and C-states off). Two loads of each module, interleaved, and 5 runs per load. kops is the median of each load. The other columns are server counters:
homa_softirqns per DATA packethijack_tcp, NAPI and SoftIRQ on cores 0 and 1 (2 RX queues, no RPS)homa_softirqtime per packet. In the first row, 199 fewer waits per 1000 packets save 80 ns per packet, about 400 ns per wait.hijack_tcp, of one port pair).Reproduction, all cp_node commands and the raw logs: https://github.com/breakertt/HomaModule/tree/feat-artifact/handoff-at-batch-end