[RFC] napi: limit GRO latency
From: Stephen Hemminger <hidden>
Date: 2012-10-08 18:59:14
Limit the latency of pending GRO in NAPI processing to 2*HZ. When the system is under heavy network load, NAPI will go into poll mode via soft irq, and only stay in the loop for two jiffies. If this occurs, process the GRO pending list to make sure and not delay outstanding TCP frames for too long. Rearrange the exit path to get rid of unnecessary goto logic. Signed-off-by: Stephen Hemminger <redacted>
--- a/net/core/dev.c 2012-10-08 09:21:27.466049785 -0700
+++ b/net/core/dev.c 2012-10-08 11:56:41.714618745 -0700@@ -3937,8 +3937,16 @@ static void net_rx_action(struct softirq * Allow this to run for 2 jiffies since which will allow * an average latency of 1.5/HZ. */ - if (unlikely(budget <= 0 || time_after(jiffies, time_limit))) - goto softnet_break; + if (unlikely(budget <= 0 || time_after(jiffies, time_limit))) { + /* Cleanup all pending GRO */ + + list_for_each_entry(n, &sd->poll_list, poll_list) + napi_gro_flush(n); + + sd->time_squeeze++; + __raise_softirq_irqoff(NET_RX_SOFTIRQ); + break; + } local_irq_enable();
@@ -3987,7 +3995,6 @@ static void net_rx_action(struct softirq netpoll_poll_unlock(have); } -out: net_rps_action_and_irq_enable(sd); #ifdef CONFIG_NET_DMA
@@ -3997,13 +4004,6 @@ out: */ dma_issue_pending_all(); #endif - - return; - -softnet_break: - sd->time_squeeze++; - __raise_softirq_irqoff(NET_RX_SOFTIRQ); - goto out; } static gifconf_func_t *gifconf_list[NPROTO];