[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Add upper bound to receiver ring poll to reduce DPC latency
From: Rachel Yan <Rachel.Yan@xxxxxxxxxx> Adds an upper bound to the ring poll iteration with optimal value found through experimentation to avoid going round the ring an infinite (or very large) number of times. This has been tested to show improvements in DPC latencies and file transfer speeds. Signed-off-by: Rachel Yan <rachel.yan@xxxxxxxxxx> --- src/xenvif/receiver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index 2145133..d469de4 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -2013,11 +2013,15 @@ ReceiverRingPoll( PXENVIF_RECEIVER Receiver; PXENVIF_FRONTEND Frontend; ULONG Count; + ULONG MaxCount; + BOOLEAN NeedQueueDpc; Receiver = Ring->Receiver; Frontend = Receiver->Frontend; Count = 0; + MaxCount = 10 * XENVIF_RECEIVER_RING_SIZE; + NeedQueueDpc = FALSE; if (!Ring->Enabled || Ring->Paused) goto done; @@ -2068,6 +2072,15 @@ ReceiverRingPoll( PXENVIF_RECEIVER_FRAGMENT Fragment; PMDL Mdl; + // avoid going through the ring an infinite (or very large) amount of times + // if the netback producer happens to fill in just enough packets to cause us + // to go around the ring multiple times. This should reduce Dpc latencies. + + if (Count >= MaxCount) { + NeedQueueDpc = TRUE; + break; + } + rsp = RING_GET_RESPONSE(&Ring->Front, rsp_cons); // netback is required to complete requests in order and place @@ -2247,7 +2260,7 @@ ReceiverRingPoll( if (!__ReceiverRingIsStopped(Ring)) ReceiverRingFill(Ring); - if (Ring->PacketQueue != NULL && + if ((NeedQueueDpc || Ring->PacketQueue != NULL) && KeInsertQueueDpc(&Ring->QueueDpc, NULL, NULL)) Ring->QueueDpcs++; -- 2.38.0.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |