netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net, neigh: Set lower cap for neigh_managed_work rearming
@ 2022-05-24 22:56 Daniel Borkmann
  2022-05-25  7:57 ` Nikolay Aleksandrov
  2022-05-26  5:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Borkmann @ 2022-05-24 22:56 UTC (permalink / raw)
  To: kuba; +Cc: wangyuweihx, pabeni, netdev, Daniel Borkmann, Nikolay Aleksandrov

Yuwei reported that plain reuse of DELAY_PROBE_TIME to rearm work queue
in neigh_managed_work is problematic if user explicitly configures the
DELAY_PROBE_TIME to 0 for a neighbor table. Such misconfig can then hog
CPU to 100% processing the system work queue. Instead, set lower interval
bound to HZ which is totally sufficient. Yuwei is additionally looking
into making the interval separately configurable from DELAY_PROBE_TIME.

Reported-by: Yuwei Wang <wangyuweihx@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://lore.kernel.org/netdev/797c3c53-ce1b-9f60-e253-cda615788f4a@iogearbox.net
---
 net/core/neighbour.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index f64ebd050f6..fd69133dc7c 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1579,7 +1579,7 @@ static void neigh_managed_work(struct work_struct *work)
 	list_for_each_entry(neigh, &tbl->managed_list, managed_list)
 		neigh_event_send_probe(neigh, NULL, false);
 	queue_delayed_work(system_power_efficient_wq, &tbl->managed_work,
-			   NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME));
+			   max(NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME), HZ));
 	write_unlock_bh(&tbl->lock);
 }
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net, neigh: Set lower cap for neigh_managed_work rearming
  2022-05-24 22:56 [PATCH net] net, neigh: Set lower cap for neigh_managed_work rearming Daniel Borkmann
@ 2022-05-25  7:57 ` Nikolay Aleksandrov
  2022-05-26  5:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2022-05-25  7:57 UTC (permalink / raw)
  To: Daniel Borkmann, kuba; +Cc: wangyuweihx, pabeni, netdev

On 25/05/2022 01:56, Daniel Borkmann wrote:
> Yuwei reported that plain reuse of DELAY_PROBE_TIME to rearm work queue
> in neigh_managed_work is problematic if user explicitly configures the
> DELAY_PROBE_TIME to 0 for a neighbor table. Such misconfig can then hog
> CPU to 100% processing the system work queue. Instead, set lower interval
> bound to HZ which is totally sufficient. Yuwei is additionally looking
> into making the interval separately configurable from DELAY_PROBE_TIME.
> 
> Reported-by: Yuwei Wang <wangyuweihx@gmail.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Nikolay Aleksandrov <razor@blackwall.org>
> Link: https://lore.kernel.org/netdev/797c3c53-ce1b-9f60-e253-cda615788f4a@iogearbox.net
> ---
>  net/core/neighbour.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index f64ebd050f6..fd69133dc7c 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -1579,7 +1579,7 @@ static void neigh_managed_work(struct work_struct *work)
>  	list_for_each_entry(neigh, &tbl->managed_list, managed_list)
>  		neigh_event_send_probe(neigh, NULL, false);
>  	queue_delayed_work(system_power_efficient_wq, &tbl->managed_work,
> -			   NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME));
> +			   max(NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME), HZ));
>  	write_unlock_bh(&tbl->lock);
>  }
>  

Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net, neigh: Set lower cap for neigh_managed_work rearming
  2022-05-24 22:56 [PATCH net] net, neigh: Set lower cap for neigh_managed_work rearming Daniel Borkmann
  2022-05-25  7:57 ` Nikolay Aleksandrov
@ 2022-05-26  5:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-26  5:10 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: kuba, wangyuweihx, pabeni, netdev, razor

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 25 May 2022 00:56:18 +0200 you wrote:
> Yuwei reported that plain reuse of DELAY_PROBE_TIME to rearm work queue
> in neigh_managed_work is problematic if user explicitly configures the
> DELAY_PROBE_TIME to 0 for a neighbor table. Such misconfig can then hog
> CPU to 100% processing the system work queue. Instead, set lower interval
> bound to HZ which is totally sufficient. Yuwei is additionally looking
> into making the interval separately configurable from DELAY_PROBE_TIME.
> 
> [...]

Here is the summary with links:
  - [net] net, neigh: Set lower cap for neigh_managed_work rearming
    https://git.kernel.org/netdev/net/c/ed6cd6a17896

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-26  5:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 22:56 [PATCH net] net, neigh: Set lower cap for neigh_managed_work rearming Daniel Borkmann
2022-05-25  7:57 ` Nikolay Aleksandrov
2022-05-26  5:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).