Re: dev_get_by_index is not hashed: O(n)

From: Ben Greear (
Date: Wed Aug 28 2002 - 03:31:25 EST

David S. Miller wrote:
> From: Ben Greear <>
> Date: Wed, 28 Aug 2002 00:49:57 -0700
> At the time I wrote the vlan code, ...
> Ben I basically rewrote nearly the entirety of your VLAN
> stack.

Excellent. One of us buggered this up, try:
vconfig add eth0 0
vconfig rem eth0 0

> Next, the lookups happen during ifconfig, and we found this
> to be a bug in how ifconfig itself worked.

ifconfig is still much slower and 'ip'. I'm not sure if that
can be helped or not though. At any rate, using RH 7.3 ifconfig
and the latest pre4 kernel, I see these numbers on my 2Ghz dual-proc athlon:

ifconfig -a for 4000 vlans:
real 44.38
user 2.76
sys 41.62

ip addr show for 4000 vlans:
real 5.57
user 1.72
sys 3.86

So, it's not as bad as it used to be, but ifconfig -a is still pretty damn
slow. It's all in the kernel too, though ifconfig is probably abusing the
kernel in some way that 'ip' does not.

> Just like the first time you brought this up, and now for the
> umpteenth time, I totally disagree. Looking up by index is
> totally slow path and therefore there is no need to complicate
> it.

So, for the record, is 44 seconds on a high-end machine acceptable
for ifconfig -a on 4000 interfaces? It doesn't bother me enough to
re-write a patch that will never be accepted, but if it were my code,
I'd change it to make it faster :)

Take it easy,

Ben Greear <>       <Ben_Greear AT>
President of Candela Technologies Inc

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to More majordomo info at

This archive was generated by hypermail 2b29 : Sat Aug 31 2002 - 22:00:01 EST