diff options
| author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-24 09:13:17 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-10-24 09:13:17 -0400 |
| commit | 7c28bd0b8ec4d128bd7660671d1b626b0abc471f (patch) | |
| tree | dbde8ba53e2059dbd6cb19aca18133b33112ddf5 /include/net/net_namespace.h | |
| parent | 8d5b2c084d2e71587e30a6ef528a8a8051e59dcd (diff) | |
rtnetlink: speedup rtnl_dump_ifinfo()
When handling large number of netdevice, rtnl_dump_ifinfo()
is very slow because it has O(N^2) complexity.
Instead of scanning one single list, we can use the 256 sub lists
of the dev_index hash table.
This considerably speedups "ip link" operations
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/net_namespace.h')
| -rw-r--r-- | include/net/net_namespace.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 699410142bfa..0addd45038ac 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -28,6 +28,10 @@ struct ctl_table_header; | |||
| 28 | struct net_generic; | 28 | struct net_generic; |
| 29 | struct sock; | 29 | struct sock; |
| 30 | 30 | ||
| 31 | |||
| 32 | #define NETDEV_HASHBITS 8 | ||
| 33 | #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) | ||
| 34 | |||
| 31 | struct net { | 35 | struct net { |
| 32 | atomic_t count; /* To decided when the network | 36 | atomic_t count; /* To decided when the network |
| 33 | * namespace should be freed. | 37 | * namespace should be freed. |
