mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
net: Rearrange loop in net_rx_action
This patch rearranges the loop in net_rx_action to reduce the amount of jumping back and forth when reading the code. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6bd373ebba
commit
ceb8d5bf17
1 changed files with 12 additions and 14 deletions
|
@ -4631,9 +4631,15 @@ static void net_rx_action(struct softirq_action *h)
|
||||||
list_splice_init(&sd->poll_list, &list);
|
list_splice_init(&sd->poll_list, &list);
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
|
|
||||||
while (!list_empty(&list)) {
|
for (;;) {
|
||||||
struct napi_struct *n;
|
struct napi_struct *n;
|
||||||
|
|
||||||
|
if (list_empty(&list)) {
|
||||||
|
if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll))
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
n = list_first_entry(&list, struct napi_struct, poll_list);
|
n = list_first_entry(&list, struct napi_struct, poll_list);
|
||||||
budget -= napi_poll(n, &repoll);
|
budget -= napi_poll(n, &repoll);
|
||||||
|
|
||||||
|
@ -4641,15 +4647,13 @@ static void net_rx_action(struct softirq_action *h)
|
||||||
* Allow this to run for 2 jiffies since which will allow
|
* Allow this to run for 2 jiffies since which will allow
|
||||||
* an average latency of 1.5/HZ.
|
* an average latency of 1.5/HZ.
|
||||||
*/
|
*/
|
||||||
if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit)))
|
if (unlikely(budget <= 0 ||
|
||||||
goto softnet_break;
|
time_after_eq(jiffies, time_limit))) {
|
||||||
|
sd->time_squeeze++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sd_has_rps_ipi_waiting(sd) &&
|
|
||||||
list_empty(&list) &&
|
|
||||||
list_empty(&repoll))
|
|
||||||
return;
|
|
||||||
out:
|
|
||||||
local_irq_disable();
|
local_irq_disable();
|
||||||
|
|
||||||
list_splice_tail_init(&sd->poll_list, &list);
|
list_splice_tail_init(&sd->poll_list, &list);
|
||||||
|
@ -4659,12 +4663,6 @@ static void net_rx_action(struct softirq_action *h)
|
||||||
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
|
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
|
||||||
|
|
||||||
net_rps_action_and_irq_enable(sd);
|
net_rps_action_and_irq_enable(sd);
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
softnet_break:
|
|
||||||
sd->time_squeeze++;
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct netdev_adjacent {
|
struct netdev_adjacent {
|
||||||
|
|
Loading…
Reference in a new issue