Skip to contentSkip to conversation

drop_monitor: remove quadratic behavior

PATCH Applied Eric Dumazet 2 participants 2 messages Feb 22, 2022 – Feb 23, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drop_monitor: remove quadratic behavior

From: Eric Dumazet <[email protected]>

drop_monitor is using an unique list on which all netdevices in the host have an element, regardless of their netns.

This scales poorly, not only at device unregister time (what I caught during my netns dismantle stress tests), but also at packet processing time whenever trace_napi_poll_hit() is called.

If the intent was to avoid adding one pointer in 'struct net_device' then surely we prefer O(1) behavior.

---
 include/linux/netdevice.h |  4 +-
 net/core/drop_monitor.c   | 79 ++++++++++++---------------------------
 2 files changed, 27 insertions(+), 56 deletions(-)
include/linux/netdevice.h +3 -1
index 93fc680b658f0f1b31c4d33a34e21b705097ad6f..c79ee22962961810f5f8f2f4529159fd308b8fc6 100644
@@ -2236,7 +2236,9 @@ struct net_device {
 #if IS_ENABLED(CONFIG_MRP)
 	struct mrp_port __rcu	*mrp_port;
 #endif
-
+#if IS_ENABLED(CONFIG_NET_DROP_MONITOR)
+	struct dm_hw_stat_delta __rcu *dm_private;
+#endif
 	struct device		dev;
 	const struct attribute_group *sysfs_groups[4];
 	const struct attribute_group *sysfs_rx_queue_group;
net/core/drop_monitor.c +24 -55

143 lines not on this page · raw message

Signature · 1 line
2.35.1.473.g83b2b277ed-goog
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Tue, 22 Feb 2022 14:04:50 -0800 you wrote:

From: Eric Dumazet <[email protected]>

drop_monitor is using an unique list on which all netdevices in the host have an element, regardless of their netns.

This scales poorly, not only at device unregister time (what I caught during my netns dismantle stress tests), but also at packet processing time whenever trace_napi_poll_hit() is called.

[...]

Here is the summary with links:
- [net-next] drop_monitor: remove quadratic behavior

    https://git.kernel.org/netdev/net-next/c/b26ef81c46ed

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html