net: avoid quadratic behavior in netdev_wait_allrefs_any()
authorEric Dumazet <edumazet@google.com>
Fri, 18 Feb 2022 06:54:30 +0000 (22:54 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Feb 2022 15:28:31 +0000 (07:28 -0800)
commit86213f80da1b1d007721cc22e04b5f5d0da33127
treee0aff65d6880e34f9aa01b9f977d814b2c3f30e1
parent086d49058cd8471046ae9927524708820f5fd1c7
net: avoid quadratic behavior in netdev_wait_allrefs_any()

If the list of devices has N elements, netdev_wait_allrefs_any()
is called N times, and linkwatch_forget_dev() is called N*(N-1)/2 times.

Fix this by calling linkwatch_forget_dev() only once per device.

Fixes: faab39f63c1f ("net: allow out-of-order netdev unregistration")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220218065430.2613262-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c