Re: [RFC PATCH net-next 5/6] net: process RPS/RFS work in kthread context
From: Wei Wang <hidden>
Date: 2020-09-18 22:45:11
On Mon, Sep 14, 2020 at 10:26 AM Wei Wang [off-list ref] wrote:
From: Paolo Abeni <pabeni@redhat.com> This patch adds the missing part to handle RFS/RPS in the napi thread handler and makes sure RPS/RFS works properly when using kthread to do napi poll. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Wei Wang <redacted> ---
With some more thoughts, I think this patch is not needed. RPS/RFS uses its own napi (sd->backlog) which currently does not have NAPI_STATE_THREADED set. So it is still being handled in softirq context by net_rx_action(). I will remove this patch in the next version if no one objects.
quoted hunk ↗ jump to hunk
net/core/dev.c | 7 +++++++ 1 file changed, 7 insertions(+)diff --git a/net/core/dev.c b/net/core/dev.c index be676c21bdc4..ab8af727058b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c@@ -6820,6 +6820,7 @@ static int napi_thread_wait(struct napi_struct *napi) static int napi_threaded_poll(void *data) { struct napi_struct *napi = data; + struct softnet_data *sd; void *have; while (!napi_thread_wait(napi)) {@@ -6835,6 +6836,12 @@ static int napi_threaded_poll(void *data) __kfree_skb_flush(); local_bh_enable(); + sd = this_cpu_ptr(&softnet_data); + if (sd_has_rps_ipi_waiting(sd)) { + local_irq_disable(); + net_rps_action_and_irq_enable(sd); + } + if (!repoll) break; --2.28.0.618.gf4bc123cb7-goog