net: rps: send out pending IPI's on CPU hotplug

IPI's from the victim cpu are not handled in dev_cpu_callback.
So these pending IPI's would be sent to the remote cpu only when
NET_RX is scheduled on the victim cpu and since this trigger is
unpredictable it would result in packet latencies on the remote cpu.

This patch add support to send the pending ipi's of victim cpu.

Change-Id: I6e688bf0d09a952468eec18f80ce6b21bf370ef1
Signed-off-by: Ashwanth Goli <ashwanth@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ashwanth Goli 2017-06-09 14:24:58 +05:30
parent f19eadaabe
commit 04e423aaa4

View file

@ -4552,6 +4552,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb)
} }
EXPORT_SYMBOL(__skb_gro_checksum_complete); EXPORT_SYMBOL(__skb_gro_checksum_complete);
static void net_rps_send_ipi(struct softnet_data *remsd)
{
#ifdef CONFIG_RPS
while (remsd) {
struct softnet_data *next = remsd->rps_ipi_next;
if (cpu_online(remsd->cpu))
smp_call_function_single_async(remsd->cpu, &remsd->csd);
remsd = next;
}
#endif
}
/* /*
* net_rps_action_and_irq_enable sends any pending IPI's for rps. * net_rps_action_and_irq_enable sends any pending IPI's for rps.
* Note: called with local irq disabled, but exits with local irq enabled. * Note: called with local irq disabled, but exits with local irq enabled.
@ -4567,20 +4580,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd)
local_irq_enable(); local_irq_enable();
/* Send pending IPI's to kick RPS processing on remote cpus. */ /* Send pending IPI's to kick RPS processing on remote cpus. */
while (remsd) { net_rps_send_ipi(remsd);
struct softnet_data *next = remsd->rps_ipi_next;
if (cpu_online(remsd->cpu)) {
smp_call_function_single_async(remsd->cpu,
&remsd->csd);
} else {
pr_err("%s() cpu offline\n", __func__);
rps_lock(remsd);
remsd->backlog.state = 0;
rps_unlock(remsd);
}
remsd = next;
}
} else } else
#endif #endif
local_irq_enable(); local_irq_enable();
@ -7495,7 +7495,7 @@ static int dev_cpu_callback(struct notifier_block *nfb,
struct sk_buff **list_skb; struct sk_buff **list_skb;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int cpu, oldcpu = (unsigned long)ocpu; unsigned int cpu, oldcpu = (unsigned long)ocpu;
struct softnet_data *sd, *oldsd; struct softnet_data *sd, *oldsd, *remsd;
if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
return NOTIFY_OK; return NOTIFY_OK;
@ -7539,6 +7539,13 @@ static int dev_cpu_callback(struct notifier_block *nfb,
raise_softirq_irqoff(NET_TX_SOFTIRQ); raise_softirq_irqoff(NET_TX_SOFTIRQ);
local_irq_enable(); local_irq_enable();
#ifdef CONFIG_RPS
remsd = oldsd->rps_ipi_list;
oldsd->rps_ipi_list = NULL;
#endif
/* send out pending IPI's on offline CPU */
net_rps_send_ipi(remsd);
/* Process offline CPU's input_pkt_queue */ /* Process offline CPU's input_pkt_queue */
while ((skb = __skb_dequeue(&oldsd->process_queue))) { while ((skb = __skb_dequeue(&oldsd->process_queue))) {
netif_rx_ni(skb); netif_rx_ni(skb);