Skip to content

Commit

Permalink
perf(virtio): send 1 interrupt in a single loop
Browse files Browse the repository at this point in the history
virtio-net benchmark data (Gbits/sec) with iperf3

AMD
     | before | after
 ----|--------|-------
  TX | 53.77  | 55.64
  RX | 49.18  | 57.6

Intel
     | before | after
 ----|--------|-------
  TX | 37.68  | 36.32
  RX | 44.17  | 47.07

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
  • Loading branch information
Lencerf committed Sep 15, 2024
1 parent 608fb13 commit b306c1a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions alioth/src/virtio/queue/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub fn handle_desc<'m, Q>(
where
Q: VirtQueue<'m>,
{
let mut send_irq = false;
'out: loop {
if !queue.has_next_desc() {
break;
Expand All @@ -44,16 +45,17 @@ where
Ok(None) => break 'out,
Ok(Some(len)) => {
queue.push_used(desc, len);
if queue.interrupt_enabled() {
fence(Ordering::SeqCst);
irq_sender.queue_irq(q_index)
}
send_irq = send_irq || queue.interrupt_enabled();
}
}
}
queue.enable_notification(true);
fence(Ordering::SeqCst);
}
if send_irq {
fence(Ordering::SeqCst);
irq_sender.queue_irq(q_index)
}
Ok(())
}

Expand Down

0 comments on commit b306c1a

Please sign in to comment.